gae

package
v0.0.97 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataStore

type DataStore[T any] struct {
	DSClient      *datastore.Client
	AutoCreateKey bool
	KeyGetter     func(*T) *datastore.Key
	KeySetter     func(*T, *datastore.Key)
	ToDBValue     func(*T) map[string]interface{}
	FromDBValue   func(map[string]interface{}) T
	GetByKeyQuery func(key string) datastore.Query
	// contains filtered or unexported fields
}

func NewDataStore

func NewDataStore[T any](kind string, dsclient *datastore.Client) *DataStore[T]

func (*DataStore[T]) DeleteByKey

func (ds *DataStore[T]) DeleteByKey(key string, ctx context.Context) error

func (*DataStore[T]) GetByKey

func (ds *DataStore[T]) GetByKey(key string, ctx context.Context) (*T, error)

func (*DataStore[T]) GetEntityKey

func (ds *DataStore[T]) GetEntityKey(entity *T) string

func (*DataStore[T]) Kind

func (ds *DataStore[T]) Kind() string

func (*DataStore[T]) ListEntities

func (ds *DataStore[T]) ListEntities(offset int, count int, ctx context.Context) ([]T, bool, error)

func (*DataStore[T]) SaveEntity

func (ds *DataStore[T]) SaveEntity(entity *T, ctx context.Context) (*T, *datastore.Key, error)

func (*DataStore[T]) SetEntityKey

func (ds *DataStore[T]) SetEntityKey(entity *T, key string) error

Jump to

Keyboard shortcuts

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