Documentation ¶
Index ¶
- func CacheKey(storeKey, key string) string
- func ExtractValue(p *pb.Property) interface{}
- type PropertyMap
- type PropertyValue
- type Record
- func (r *Record) CacheKey() string
- func (r *Record) DecodeBytes(by []byte) error
- func (r *Record) EncodeBytes() ([]byte, error)
- func (r *Record) Load(ps []datastore.Property) error
- func (r *Record) LoadKey(k *datastore.Key) error
- func (r *Record) Save() ([]datastore.Property, error)
- func (r *Record) ToProto() *pb.Record
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CacheKey ¶
CacheKey returns a cache key string to manage cached entries. concatenates store and record keys separated by a slash.
func ExtractValue ¶
ExtractValue returns the value that is held by the property.
Types ¶
type PropertyMap ¶
type PropertyMap map[string]*PropertyValue
PropertyMap represents user-defined custom properties.
func NewPropertyMapFromProto ¶
func NewPropertyMapFromProto(proto map[string]*pb.Property) PropertyMap
NewPropertyMapFromProto creates a new Property instance from a proto. Passing nil returns an empty map.
func (*PropertyMap) Load ¶
func (m *PropertyMap) Load(ps []datastore.Property) error
Load implements the Datastore PropertyLoadSaver interface and converts individual properties to PropertyMap.
type PropertyValue ¶
type PropertyValue struct { Type pb.Property_Type IntegerValue int64 StringValue string BooleanValue bool }
PropertyValue is an internal representation of the user-defined property. See the Open Saves API definition for details.
func NewPropertyValueFromProto ¶
func NewPropertyValueFromProto(proto *pb.Property) *PropertyValue
NewPropertyValueFromProto creates a new Property instance from a proto. Passing nil returns a zero-initialized Property.
func (*PropertyValue) ToProto ¶
func (p *PropertyValue) ToProto() *pb.Property
ToProto converts the struct to a proto.
type Record ¶
type Record struct { Key string `datastore:"-"` Blob []byte `datastore:",noindex"` BlobSize int64 ExternalBlob uuid.UUID `datastore:"-"` Properties PropertyMap OwnerID string Tags []string OpaqueString string `datastore:",noindex"` // Timestamps keeps track of creation and modification times and stores a randomly // generated UUID to maintain consistency. Timestamps timestamps.Timestamps // StoreKey is used to generate a cache key and needs to be set // before calling the CacheKey function. // It is automatically set when read from Datastore. StoreKey string `datastore:"-"` }
Record represents a Open Saves record in the metadata database. See the Open Saves API definition for details.
func FromProto ¶
FromProto creates a new Record instance from a proto. Passing nil returns a zero-initialized proto.
func (*Record) CacheKey ¶
CacheKey returns a cache key string to manage cached entries. concatenates store and record keys separated by a slash.
func (*Record) DecodeBytes ¶
DecodeBytes deserializes the byte slice given by by.
func (*Record) EncodeBytes ¶
EncodeBytes returns a serialized byte slice of the object.
func (*Record) Load ¶
Load implements the Datastore PropertyLoadSaver interface and converts Datastore properties to corresponding struct fields.
func (*Record) LoadKey ¶
LoadKey implements the KeyLoader interface and sets the value to the Key and StoreKey fields.