Exemplo n.º 1
1
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)
}
Exemplo n.º 2
0
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)
}
Exemplo n.º 3
0
func (m *Member) Load(tx *dbr.Tx, number int64) error {

	return tx.Select("*").
		From("member").
		Where("number = ?", number).
		LoadStruct(m)
}
Exemplo n.º 4
0
// データを保存する
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
}
Exemplo n.º 5
0
func (m *Member) Save(tx *dbr.Tx) error {

	_, err := tx.InsertInto("member").
		Columns("number", "name", "position", "created_at").
		Record(m).
		Exec()

	return err
}
Exemplo n.º 6
0
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
}
Exemplo n.º 7
0
func (p *UPoints) Load(tx *dbr.Tx) error {
	return tx.Select("*").
		From("u_point").
		LoadStruct(p)
}