Example #1
0
func getToken(db *pg.Session, key string) (*Model, error) {
	resetToken, err := db.FindOne(&Model{}, "key = $1", key)
	if err != nil {
		return nil, err
	}
	return resetToken.(*Model), nil
}
Example #2
0
func GetById(db *pg.Session, id int64) (*Model, error) {
	user, err := db.FindOne(&Model{}, "id = $1", id)
	if err != nil {
		return nil, err
	}
	return user.(*Model), nil
}
Example #3
0
func GetByEmail(db *pg.Session, email string) (*Model, error) {
	user, err := db.FindOne(&Model{}, "email = $1", email)
	if err != nil {
		return nil, err
	}
	return user.(*Model), nil
}
Example #4
0
func GetById(db *pg.Session, id int) (*Model, error) {
	entity, err := db.FindOne(&Model{}, "id=$1", id)
	if err != nil {
		return nil, err
	}
	return entity.(*Model), nil
}