Documentation ¶
Index ¶
- type Asset
- type AssetMissError
- type CachemissErr
- type Cfg
- type DSAsset
- type DSmissErr
- type DataLayer
- type DatastoreDB
- type RedisAsset
- type RedisDB
- type Sub
- type TestAsset
- func (ta TestAsset) GetDSIDKey() (int64, bool)
- func (ta TestAsset) GetDSKind() string
- func (ta TestAsset) GetDSNameKey() (string, bool)
- func (ta TestAsset) GetDSNamespace() string
- func (ta TestAsset) GetRedisField() string
- func (ta TestAsset) GetRedisKey() interface{}
- func (ta TestAsset) GetTTL() time.Duration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Asset ¶
type Asset interface { DSAsset RedisAsset }
Asset is a interface combining both Redis and Datastore operations. A struct must implement this interface to take advantage of the combined usage of both Redis and Datastore.
type AssetMissError ¶
type AssetMissError struct { DSmissErr DSmissErr CachemissErr CachemissErr }
func (AssetMissError) Error ¶
func (amr AssetMissError) Error() string
type CachemissErr ¶
func (CachemissErr) Error ¶
func (e CachemissErr) Error() string
type Cfg ¶
type Cfg struct { RedisAddrs string RedisPassword string Db string MaxIdle int MaxActive int IdleTimeout time.Duration MaxConnLifetime time.Duration Wait bool TestOnBorrow func(c redis.Conn, t time.Time) error Client *datastore.Client }
Config struct to use with the NewWithCfg wrapper.
type DSAsset ¶
type DSAsset interface { GetDSKind() string GetDSNameKey() (string, bool) GetDSIDKey() (int64, bool) GetDSNamespace() string }
DSAsset is the interface that a struct must implement to use the Datastore operations. GetDSKind should return the Datastore Kind for the object to be save/get from. GetDSNameKey and GetDSIDKey: should return a identifier to be used in the Datastore Key along with a bool flag indicating which one (name key or id key) should be used. - If both true, Id key will be used, if both false will use Datasore Incomplete Key. GetDSNamespace should return the Datastore Namespace to be used.
type DataLayer ¶
type DataLayer struct { Redis RedisDB DS DatastoreDB }
func NewWithCfg ¶
type DatastoreDB ¶
type DatastoreDB struct {
// contains filtered or unexported fields
}
type RedisAsset ¶
type RedisAsset interface { GetRedisKey() interface{} GetRedisField() string GetTTL() time.Duration }
RedisAsset is the interface that a struct must implement to use the Redis operations. GetRedisKey should return the Key for the Redis Hash GetRedisField should return the Field for the Redis Hash GetTTL should return the duration of ttl for a key. Min value: 1 second
The Redis operations rely on encoding/json Marshal and Unmarshal methods of the RedisAsset implementer struct. The bytes slice on these methods are use to load and save the structs in Redis
type RedisDB ¶
type TestAsset ¶
Asset impl for testing
func (TestAsset) GetDSIDKey ¶
func (TestAsset) GetDSNameKey ¶
func (TestAsset) GetDSNamespace ¶
func (TestAsset) GetRedisField ¶
func (TestAsset) GetRedisKey ¶
func (ta TestAsset) GetRedisKey() interface{}