Documentation
¶
Overview ¶
Package memory provides a concurrency-safe adapter for tests, examples, and ephemeral development. It is not durable storage.
Index ¶
- type Adapter
- func (a *Adapter) Capabilities() betterauth.AdapterCapabilities
- func (a *Adapter) ConsumeOne(_ context.Context, query betterauth.DeleteQuery) (betterauth.Record, error)
- func (a *Adapter) Count(ctx context.Context, query betterauth.CountQuery) (int64, error)
- func (a *Adapter) Create(_ context.Context, query betterauth.CreateQuery) (betterauth.Record, error)
- func (a *Adapter) Delete(_ context.Context, query betterauth.DeleteQuery) error
- func (a *Adapter) DeleteMany(_ context.Context, query betterauth.DeleteQuery) (int64, error)
- func (a *Adapter) FindMany(_ context.Context, query betterauth.FindManyQuery) ([]betterauth.Record, error)
- func (a *Adapter) FindOne(_ context.Context, query betterauth.FindOneQuery) (betterauth.Record, error)
- func (a *Adapter) ID() string
- func (a *Adapter) IncrementOne(_ context.Context, query betterauth.IncrementQuery) (betterauth.Record, error)
- func (a *Adapter) Transaction(_ context.Context, callback func(betterauth.DatabaseAdapter) error) error
- func (a *Adapter) Update(_ context.Context, query betterauth.UpdateQuery) (betterauth.Record, error)
- func (a *Adapter) UpdateMany(_ context.Context, query betterauth.UpdateQuery) (int64, error)
- func (a *Adapter) WithSchema(schema betterauth.Schema) (betterauth.DatabaseAdapter, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
func New ¶
func New() *Adapter
New returns an empty adapter that enforces the core schema's unique fields and indexes. A server calls WithSchema to replace them with the rules of its merged schema.
func (*Adapter) Capabilities ¶
func (a *Adapter) Capabilities() betterauth.AdapterCapabilities
func (*Adapter) ConsumeOne ¶
func (a *Adapter) ConsumeOne(_ context.Context, query betterauth.DeleteQuery) (betterauth.Record, error)
func (*Adapter) Count ¶
func (a *Adapter) Count(ctx context.Context, query betterauth.CountQuery) (int64, error)
func (*Adapter) Create ¶
func (a *Adapter) Create(_ context.Context, query betterauth.CreateQuery) (betterauth.Record, error)
func (*Adapter) Delete ¶
func (a *Adapter) Delete(_ context.Context, query betterauth.DeleteQuery) error
func (*Adapter) DeleteMany ¶
func (a *Adapter) DeleteMany(_ context.Context, query betterauth.DeleteQuery) (int64, error)
func (*Adapter) FindMany ¶
func (a *Adapter) FindMany(_ context.Context, query betterauth.FindManyQuery) ([]betterauth.Record, error)
func (*Adapter) FindOne ¶
func (a *Adapter) FindOne(_ context.Context, query betterauth.FindOneQuery) (betterauth.Record, error)
func (*Adapter) IncrementOne ¶
func (a *Adapter) IncrementOne(_ context.Context, query betterauth.IncrementQuery) (betterauth.Record, error)
func (*Adapter) Transaction ¶
func (a *Adapter) Transaction(_ context.Context, callback func(betterauth.DatabaseAdapter) error) error
func (*Adapter) Update ¶
func (a *Adapter) Update(_ context.Context, query betterauth.UpdateQuery) (betterauth.Record, error)
func (*Adapter) UpdateMany ¶
func (a *Adapter) UpdateMany(_ context.Context, query betterauth.UpdateQuery) (int64, error)
func (*Adapter) WithSchema ¶ added in v1.1.0
func (a *Adapter) WithSchema(schema betterauth.Schema) (betterauth.DatabaseAdapter, error)
WithSchema returns an adapter that shares this adapter's data and enforces the unique fields and unique compound indexes of the given logical schema, using their stored model and field names.