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