repository

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entity

type Entity interface {
	DocId() string
	SetDocId(id string)
	UniqFields() map[string]interface{}
}

type PaginationResult

type PaginationResult[T any] struct {
	Items   []T             `json:"items"`
	Limit   int             `json:"limit"`
	Next    string          `json:"next"`
	Prev    string          `json:"prev"`
	Filters *[]query.Filter `json:"filters,omitempty"`
}

type Repository

type Repository[T Entity, TT any] interface {
	Get(ctx context.Context, opts *query.QueryOptions) (*PaginationResult[T], error)
	GetByID(ctx context.Context, id string) (*T, error)
	Create(ctx context.Context, obj T) (*string, error)
	CreateEasy(ctx context.Context, obj T) (*string, error)
	Update(ctx context.Context, id string, data map[string]interface{}) error
	Delete(ctx context.Context, id string) error
}

func NewFirebaseRepository

func NewFirebaseRepository[T Entity, TT any](db *firestore.Client, ressoucre string) Repository[T, TT]

Jump to

Keyboard shortcuts

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