2023-09-06 22:20:09 +01:00
|
|
|
package client_store
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"github.com/1f349/tulip/database"
|
|
|
|
"github.com/go-oauth2/oauth2/v4"
|
|
|
|
)
|
|
|
|
|
|
|
|
type ClientStore struct {
|
2024-03-11 12:39:52 +00:00
|
|
|
db *database.Queries
|
2023-09-06 22:20:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
var _ oauth2.ClientStore = &ClientStore{}
|
|
|
|
|
2024-03-11 12:39:52 +00:00
|
|
|
func New(db *database.Queries) *ClientStore {
|
2023-09-06 22:20:09 +01:00
|
|
|
return &ClientStore{db: db}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *ClientStore) GetByID(ctx context.Context, id string) (oauth2.ClientInfo, error) {
|
2024-03-11 12:39:52 +00:00
|
|
|
a, err := c.db.GetClientInfo(ctx, id)
|
|
|
|
return &a, err
|
2023-09-06 22:20:09 +01:00
|
|
|
}
|