diff options
author | 2021-08-25 15:34:33 +0200 | |
---|---|---|
committer | 2021-08-25 15:34:33 +0200 | |
commit | 2dc9fc1626507bb54417fc4a1920b847cafb27a2 (patch) | |
tree | 4ddeac479b923db38090aac8bd9209f3646851c1 /internal/oauth/clientstore.go | |
parent | Manually approves followers (#146) (diff) | |
download | gotosocial-2dc9fc1626507bb54417fc4a1920b847cafb27a2.tar.xz |
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
Diffstat (limited to 'internal/oauth/clientstore.go')
-rw-r--r-- | internal/oauth/clientstore.go | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/internal/oauth/clientstore.go b/internal/oauth/clientstore.go index 2e7e0ae88..a642f6cfa 100644 --- a/internal/oauth/clientstore.go +++ b/internal/oauth/clientstore.go @@ -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 |