mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-17 13:27:29 -06:00
Pg to bun (#148)
* start moving to bun * changing more stuff * more * and yet more * tests passing * seems stable now * more big changes * small fix * little fixes
This commit is contained in:
parent
071eca20ce
commit
2dc9fc1626
713 changed files with 98694 additions and 22704 deletions
|
|
@ -39,10 +39,8 @@ func NewClientStore(db db.Basic) oauth2.ClientStore {
|
|||
}
|
||||
|
||||
func (cs *clientStore) GetByID(ctx context.Context, clientID string) (oauth2.ClientInfo, error) {
|
||||
poc := &Client{
|
||||
ID: clientID,
|
||||
}
|
||||
if err := cs.db.GetByID(clientID, poc); err != nil {
|
||||
poc := &Client{}
|
||||
if err := cs.db.GetByID(ctx, clientID, poc); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return models.New(poc.ID, poc.Secret, poc.Domain, poc.UserID), nil
|
||||
|
|
@ -55,19 +53,19 @@ func (cs *clientStore) Set(ctx context.Context, id string, cli oauth2.ClientInfo
|
|||
Domain: cli.GetDomain(),
|
||||
UserID: cli.GetUserID(),
|
||||
}
|
||||
return cs.db.UpdateByID(id, poc)
|
||||
return cs.db.Put(ctx, poc)
|
||||
}
|
||||
|
||||
func (cs *clientStore) Delete(ctx context.Context, id string) error {
|
||||
poc := &Client{
|
||||
ID: id,
|
||||
}
|
||||
return cs.db.DeleteByID(id, poc)
|
||||
return cs.db.DeleteByID(ctx, id, poc)
|
||||
}
|
||||
|
||||
// Client is a handy little wrapper for typical oauth client details
|
||||
type Client struct {
|
||||
ID string `pg:"type:CHAR(26),pk,notnull"`
|
||||
ID string `bun:"type:CHAR(26),pk,notnull"`
|
||||
Secret string
|
||||
Domain string
|
||||
UserID string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue