Documentation
¶
Index ¶
- func GetMulti[T Model](ctx context.Context, db *Client, ids any) ([]T, error)
- func Query[T Model](ctx context.Context, db *Client, q *datastore.Query, cursor string) ([]T, string, error)
- type AfterDelete
- type AfterSave
- type Base
- type BeforeDelete
- type BeforeSave
- type Client
- func (db *Client) Client() *ds.Client
- func (db *Client) Delete(ctx context.Context, val interface{}) error
- func (db *Client) DeleteMulti(ctx context.Context, vals interface{}) error
- func (db *Client) Get(ctx context.Context, val interface{}) error
- func (db *Client) GetMulti(ctx context.Context, vals interface{}) error
- func (db *Client) Key(val interface{}) *datastore.Key
- func (db *Client) Keys(val interface{}) []*datastore.Key
- func (db *Client) Put(ctx context.Context, val interface{}) error
- func (db *Client) PutMulti(ctx context.Context, vals interface{}) error
- func (db *Client) Query(ctx context.Context, q *datastore.Query, cursor string, vals interface{}) ([]*datastore.Key, string, error)
- func (db *Client) RawClient() *datastore.Client
- func (db *Client) Transact(ctx context.Context, f func(tx *Transaction) error) (*datastore.Commit, error)
- type Model
- type OnLoad
- type Option
- type Transaction
- func (t *Transaction) Delete(val interface{}) error
- func (t *Transaction) DeleteMulti(vals interface{}) error
- func (t *Transaction) Get(val interface{}) error
- func (t *Transaction) GetMulti(vals interface{}) error
- func (t *Transaction) Put(val interface{}) error
- func (t *Transaction) PutMulti(vals interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AfterDelete ¶
type Base ¶
type Base struct {
// contains filtered or unexported fields
}
Base provides default implementation for Model interface and common fields. Embed this in your struct to use dsorm.
type BeforeDelete ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps datastore and cache operations.
func New ¶
New creates a new Client with options value. It auto-detects caching backend: App Engine (Memcache), Redis (env REDIS_ADDR), or Memory.
func (*Client) DeleteMulti ¶
type Option ¶
type Option func(*options)
func WithDatastoreClient ¶
func WithEncryptionKey ¶
func WithProjectID ¶
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction wraps ds.Transaction to provide dsorm functionality (ID mapping, lifecycle hooks).
func (*Transaction) Delete ¶
func (t *Transaction) Delete(val interface{}) error
Delete deletes an entity within the transaction.
func (*Transaction) DeleteMulti ¶
func (t *Transaction) DeleteMulti(vals interface{}) error
DeleteMulti deletes multiple entities within the transaction.
func (*Transaction) Get ¶
func (t *Transaction) Get(val interface{}) error
Get loads entity to val within the transaction.
func (*Transaction) GetMulti ¶
func (t *Transaction) GetMulti(vals interface{}) error
GetMulti loads multiple entities within the transaction.
func (*Transaction) Put ¶
func (t *Transaction) Put(val interface{}) error
Put saves an entity within the transaction.
func (*Transaction) PutMulti ¶
func (t *Transaction) PutMulti(vals interface{}) error
PutMulti saves multiple entities within the transaction.
Directories
¶
| Path | Synopsis |
|---|---|
|
cache
|
|
|
memory
Package memory IS NOT MEANT TO BE USED - THIS IS FOR PROOF OF CONCEPT AND TESTING ONLY, IT IS A LOCAL MEMORY STORE AND WILL RESULT IN INCONSISTENT CACHING FOR DISTRIBUTED SYSTEMS!
|
Package memory IS NOT MEANT TO BE USED - THIS IS FOR PROOF OF CONCEPT AND TESTING ONLY, IT IS A LOCAL MEMORY STORE AND WILL RESULT IN INCONSISTENT CACHING FOR DISTRIBUTED SYSTEMS! |
|
internal
|
|