This commit is contained in:
Jay
2018-09-02 09:15:27 +08:00
parent 3b7aa71338
commit 521607ff89
4 changed files with 90 additions and 7 deletions
+7 -6
View File
@@ -6,11 +6,11 @@ import (
// Account - table
type Account struct {
ID string `db:"id"`
Account string `db:"account"`
Password string `db:"password"`
Ctime time.Time `db:"ctime"`
Mtime time.Time `db:"mtime"`
ID string `db:"id" cc:"id"`
Account string `db:"account" cc:"account"`
Password string `db:"password" cc:"password"`
Ctime time.Time `db:"ctime" cc:"ctime"`
Mtime time.Time `db:"mtime" cc:"ctime"`
}
// GetAllAccount -
@@ -24,7 +24,8 @@ func GetAllAccount() (accs []Account, err error) {
// GetAccount -
func GetAccount(account string) (acc *Account, err error) {
err = x.Select(acc, `select * from "public"."account" where "account" = $1`, account)
acc = &Account{}
err = x.Get(acc, `select * from "public"."account" where "account" = $1`, account)
if err != nil {
return nil, err
}