db

package
v0.0.0-...-bdf525e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NotFound = errors.New("not found")

Functions

This section is empty.

Types

type DB

type DB struct {
	*firestore.Client
	// contains filtered or unexported fields
}

func New

func New(cfg *config.Config) (*DB, error)

func (*DB) CollectionFor

func (db *DB) CollectionFor(model model.Type) *firestore.CollectionRef

type Fetcher

type Fetcher[M model.Typer] struct {
	// contains filtered or unexported fields
}

func NewFetcher

func NewFetcher[M model.Typer](db *DB) Fetcher[M]

func (Fetcher[Model]) Fetch

func (f Fetcher[Model]) Fetch(ctx context.Context, id string) (Model, error)

func (Fetcher[Model]) FetchFirst

func (f Fetcher[Model]) FetchFirst(ctx context.Context, queryFunc QueryFunc) (Model, error)

func (Fetcher[Model]) FetchMany

func (f Fetcher[Model]) FetchMany(ctx context.Context, ids ...string) ([]Model, error)

func (Fetcher[Model]) Query

func (f Fetcher[Model]) Query(ctx context.Context, queryFunc QueryFunc) ([]Model, error)

func (Fetcher[Model]) Type

func (f Fetcher[Model]) Type() model.Type

func (Fetcher[Model]) Zero

func (f Fetcher[Model]) Zero() Model

type QueryFunc

type QueryFunc func(query firestore.Query) firestore.Query

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL