func (m *Members) Load(tx *dbr.Tx, position string) error { var condition dbr.Condition if position != "" { condition = dbr.Eq("position", position) } return tx.Select("*"). From("member"). Where(condition). LoadStruct(m) }
func (p *UPoints) LoadTargetAccountPoints(tx *dbr.Tx, account_id int64) error { logrus.Debug(account_id) return tx.Select("*"). From("u_point"). Where("account_id = ?", account_id). LoadStruct(p) }
func (m *Member) Load(tx *dbr.Tx, number int64) error { return tx.Select("*"). From("member"). Where("number = ?", number). LoadStruct(m) }
// データを保存する func (p *UPoint) Save(tx *dbr.Tx) error { _, err := tx.InsertInto("u_point"). Columns("account_id", "m_point_id", "value", "created_at", "updated_at"). Record(p). Exec() return err }
func (m *Member) Save(tx *dbr.Tx) error { _, err := tx.InsertInto("member"). Columns("number", "name", "position", "created_at"). Record(m). Exec() return err }
func (s *Snippet) Save(tx *dbr.Tx) error { _, err := tx.InsertInto("snippets"). Columns("snippet_id", "snippet_title", "snippet_text", "user_id", "created_at", "updated_at"). Record(s). Exec() return err }
func (p *UPoints) Load(tx *dbr.Tx) error { return tx.Select("*"). From("u_point"). LoadStruct(p) }