Example #1
0
func (s *Storage) CreateClient(c osin.Client) error {
	userData, err := dataToString(c.GetUserData())
	if err != nil {
		return err
	}
	_, err = s.db.Exec("INSERT INTO client (id, secret, redirect_uri, extra) VALUES ($1, $2, $3, $4)", c.GetId(), c.GetSecret(), c.GetRedirectUri(), userData)
	return err
}
Example #2
0
func (s *Storage) UpdateClient(c osin.Client) error {
	userData, err := dataToString(c.GetUserData())
	if err != nil {
		return err
	}

	_, err = s.db.Exec("UPDATE client SET (secret, redirect_uri, extra) = ($2, $3, $4) WHERE id=$1", c.GetId(), c.GetSecret(), c.GetRedirectUri(), userData)
	return err
}