Documentation ¶
Index ¶
- type BufferedDriver
- type DBTableRecordType
- type Database
- func (db *Database) Close() error
- func (db *Database) Create(recordType DBTableRecordType, key string, doc interface{}) error
- func (db *Database) Delete(recordType DBTableRecordType, key string) error
- func (db *Database) List(recordType DBTableRecordType, i interface{}) (err error)
- func (db *Database) Ping() error
- func (db *Database) Read(recordType DBTableRecordType, key string, i interface{}) error
- func (db *Database) Update(recordType DBTableRecordType, key string, doc interface{}) error
- type Driver
- type Record
- type RecordDoesNotExistError
- type RecordExistsError
- type RedisClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BufferedDriver ¶
BufferedDriver represents a low level storage which exposes a Bytes method to allow serialization to disk
func NewMemoryDBDriverWithCollection ¶
func NewMemoryDBDriverWithCollection(collection []map[string]string) (BufferedDriver, error)
NewMemoryDBDriverWithCollection seeds the memory database with some initialisaiton data
type DBTableRecordType ¶
type DBTableRecordType string
func (DBTableRecordType) String ¶
func (dbtype DBTableRecordType) String() string
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database stores data for terraform server
func NewDatabaseWithDriver ¶
NewDatabaseWithDriver creates a new Database struct with
func (*Database) Create ¶
func (db *Database) Create(recordType DBTableRecordType, key string, doc interface{}) error
func (*Database) Delete ¶
func (db *Database) Delete(recordType DBTableRecordType, key string) error
func (*Database) List ¶
func (db *Database) List(recordType DBTableRecordType, i interface{}) (err error)
type Driver ¶
type Driver interface { Create(recordType DBTableRecordType, key string, doc interface{}) error Read(recordType DBTableRecordType, key string, i interface{}) error List(recordType DBTableRecordType, i interface{}) error Update(recordType DBTableRecordType, key string, doc interface{}) error Delete(recordType DBTableRecordType, key string) error Ping() error Close() error }
Driver represents a low level storage serialiser/ deserialiser This is wrapped in the Database
func NewJSONDBDriver ¶
NewJSONDBDriver returns a json database object
func NewMemoryDBDriver ¶
NewMemoryDBDriver returns a memory database object
func NewRedisDBDriver ¶
func NewRedisDBDriver(namespace, address, password string, database int, driver RedisClient) (r Driver, err error)
NewRedisDBDriver returns a redis database object
type Record ¶
type Record struct { Key string Type DBTableRecordType Value string }
Record is an untyped, schemaless record type which all record types embed and implement
type RecordDoesNotExistError ¶
type RecordDoesNotExistError error
type RecordExistsError ¶
type RecordExistsError error
type RedisClient ¶
type RedisClient interface { Close() error Del(...string) *redis.IntCmd Keys(string) *redis.StringSliceCmd Get(string) *redis.StringCmd MGet(keys ...string) *redis.SliceCmd Ping() *redis.StatusCmd Set(string, interface{}, time.Duration) *redis.StatusCmd }
RedisClient interface to allow custom redis clients to be used