go-gallery/models/account.go

30 lines
603 B
Go

package models
import (
"time"
)
// Account - Account table struct
type Account struct {
ID string `xorm:"id"`
Account string `xorm:"account"`
Password string `xorm:"password"`
Nick string `xorm:"nick"`
Email string `xorm:"email"`
Ctime time.Time `xorm:"ctime"`
Mtime time.Time `xorm:"mtime"`
}
// GetAllAccount - all account
func GetAllAccount() ([]Account, error) {
var accs []Account
err := x.Table("account").Find(&accs)
return accs, err
}
// Get - get account info
func (c *Account) Get() error {
_, err := x.Table("account").Get(c)
return err
}