Documentation
¶
Overview ¶
Package authadapter translates BetterAuth adapter JSON calls into typed sqlc queries.
Index ¶
- Constants
- Variables
- type Adapter
- func (a *Adapter) Count(ctx context.Context, model string) (int64, error)
- func (a *Adapter) Create(ctx context.Context, model string, data map[string]json.RawMessage) (map[string]any, error)
- func (a *Adapter) Delete(ctx context.Context, model string, where []WhereClause) error
- func (a *Adapter) DeleteMany(ctx context.Context, model string, where []WhereClause) error
- func (a *Adapter) FindMany(ctx context.Context, model string, where []WhereClause, opts FindManyOpts) ([]map[string]any, error)
- func (a *Adapter) FindOne(ctx context.Context, model string, where []WhereClause) (map[string]any, error)
- func (a *Adapter) Update(ctx context.Context, model string, where []WhereClause, ...) (map[string]any, error)
- func (a *Adapter) UpdateMany(ctx context.Context, model string, where []WhereClause, ...) (int64, error)
- type FindManyOpts
- type SortBy
- type WhereClause
Constants ¶
View Source
const ( ModelUser = "user" ModelSession = "session" ModelAccount = "account" ModelVerification = "verification" ModelJwks = "jwks" )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter dispatches BetterAuth adapter calls to typed sqlc queries.
func New ¶
New creates an Adapter backed by the given queries and database connection. The db parameter is used for dynamic SQL queries (findMany, updateMany) that cannot be expressed through sqlc.
func (*Adapter) DeleteMany ¶
func (*Adapter) FindMany ¶
func (a *Adapter) FindMany(ctx context.Context, model string, where []WhereClause, opts FindManyOpts) ([]map[string]any, error)
func (*Adapter) UpdateMany ¶
func (a *Adapter) UpdateMany(ctx context.Context, model string, where []WhereClause, data map[string]json.RawMessage) (int64, error)
type FindManyOpts ¶
FindManyOpts holds optional parameters for FindMany.
type WhereClause ¶
type WhereClause struct {
Field string `json:"field"`
Operator string `json:"operator"`
Value json.RawMessage `json:"value"`
Connector string `json:"connector"`
}
WhereClause mirrors the BetterAuth CleanedWhere type sent over JSON.
Click to show internal directories.
Click to hide internal directories.