Documentation ¶
Index ¶
- Variables
- func CleanProperties(properties []datastore.Property, filters map[string]IsOkToRemove) (filtered []datastore.Property, err error)
- func IsDuplicate(_ datastore.Property) bool
- func IsEmptyByteArray(p datastore.Property) bool
- func IsEmptyJSON(p datastore.Property) bool
- func IsEmptyString(p datastore.Property) bool
- func IsEmptyStringOrSpecificValue(v string) func(p datastore.Property) bool
- func IsFalse(p datastore.Property) bool
- func IsObsolete(_ datastore.Property) bool
- func IsZeroBool(p datastore.Property) bool
- func IsZeroFloat(p datastore.Property) bool
- func IsZeroInt(p datastore.Property) bool
- func IsZeroTime(p datastore.Property) bool
- func NewDatabase(ctx context.Context, projectID string) (db dal.DB, err error)
- type IsOkToRemove
- type SaverWrapper
Constants ¶
This section is empty.
Variables ¶
var ( // LoggingEnabled a flag to enable or disable logging inside GAE DAL LoggingEnabled = true // TODO: move to Context.WithValue() // NewIncompleteKey creates new incomplete key. NewIncompleteKey = datastore.IncompleteKey // NewKey creates new key. NewKey = datastore.IDKey )
var ErrEmptyKind = errors.New("record holder returned empty kind")
ErrEmptyKind indicates record holder returned empty kind
var Put = func(c context.Context, client *datastore.Client, key *datastore.Key, val interface{}) (*datastore.Key, error) { if val == nil { panic("val == nil") } var err error isPartialKey := key.Incomplete() if LoggingEnabled { buf := new(bytes.Buffer) if err = logEntityProperties(buf, fmt.Sprintf("dbPut(%v) => properties:", key2str(key)), val); err != nil { log.Errorf(c, "Put(%v) failed to log properties: %v", key2str(key), err) } else { log.Debugf(c, buf.String()) } } if key, err = client.Put(c, key, val); err != nil { return key, fmt.Errorf("failed to put to db (key=%v): %w", key2str(key), err) } else if LoggingEnabled && isPartialKey { log.Debugf(c, "dbPut() inserted new record with key: "+key2str(key)) } return key, err }
Put saves record to datastore
var PutMulti = func(c context.Context, client *datastore.Client, keys []*datastore.Key, vals interface{}) ([]*datastore.Key, error) { if LoggingEnabled { logKeys(c, "dbPutMulti", "", keys) } return client.PutMulti(c, keys, vals) }
PutMulti saves multipe entities to datastore
Functions ¶
func CleanProperties ¶
func CleanProperties(properties []datastore.Property, filters map[string]IsOkToRemove) (filtered []datastore.Property, err error)
CleanProperties removes properties in place and returns filtered slice
func IsDuplicate ¶
IsDuplicate indicates property is duplicate
func IsEmptyByteArray ¶
IsEmptyByteArray returns true of property value is nil or empty byte array
func IsEmptyJSON ¶
IsEmptyJSON returns true if property value is empty string or empty array or empty object
func IsEmptyString ¶
IsEmptyString returns true if property value iz empty string
func IsEmptyStringOrSpecificValue ¶
IsEmptyStringOrSpecificValue returns true if property value is empty string or has specific value
func IsObsolete ¶
IsObsolete used for obsolete properties
func IsZeroBool ¶
IsZeroBool returns true if property value false
func IsZeroFloat ¶
IsZeroFloat returns true if property value 0.0
func IsZeroTime ¶
IsZeroTime returns true of property value iz zero time
Types ¶
type IsOkToRemove ¶
IsOkToRemove checks if it's OK to remove property value
type SaverWrapper ¶
type SaverWrapper struct { }
SaverWrapper used to serialize struct to properties on saving
Source Files ¶
- aa_proxies.go
- database.go
- datastore_delete.go
- datastore_delete_multi.go
- datastore_get.go
- datastore_get_multi.go
- datastore_insert.go
- datastore_multi.go
- datastore_set_multi.go
- load_saver.go
- logging.go
- properties.go
- put.go
- query2query.go
- reader.go
- select_all.go
- select_all_ids.go
- test_mocks.go
- transaction.go
- transaction_run.go