mtfosbot/model/line_user.go

24 lines
546 B
Go
Raw Normal View History

2018-09-12 10:07:49 +00:00
package model
import "time"
// LineUser -
type LineUser struct {
ID string `db:"id" cc:"id"`
Name string `db:"name" cc:"name"`
Ctime time.Time `db:"ctime" cc:"ctime"`
Mtime time.Time `db:"mtime" cc:"mtime"`
}
2018-09-19 16:17:00 +00:00
// GetLineUserByID -
func GetLineUserByID(id string) (u *LineUser, err error) {
err = x.Get(&u, `select * from "public"."line_user" where "id" = $1`, id)
return
}
// Add -
func (p *LineUser) Add() (err error) {
_, err = x.NamedExec(`insert into "public"."line_user" ("id", "name") values (:id, :name)`, p)
return
}