skydbtest

package
v0.21.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MapConn

type MapConn struct {
	UserMap map[string]skydb.UserInfo

	skydb.Conn
	// contains filtered or unexported fields
}

MapConn is a naive memory implementation of skydb.Conn

func NewMapConn

func NewMapConn() *MapConn

NewMapConn returns a new MapConn.

func (*MapConn) AddRelation

func (conn *MapConn) AddRelation(user string, name string, targetUser string) error

AddRelation is not implemented.

func (*MapConn) Close

func (conn *MapConn) Close() error

Close does nothing.

func (*MapConn) CreateUser

func (conn *MapConn) CreateUser(userinfo *skydb.UserInfo) error

CreateUser creates a UserInfo in UserMap.

func (*MapConn) DeleteDevice

func (conn *MapConn) DeleteDevice(id string) error

DeleteDevice is not implemented.

func (*MapConn) DeleteDevicesByToken

func (conn *MapConn) DeleteDevicesByToken(token string, t time.Time) error

DeleteDevicesByToken is not implemented.

func (*MapConn) DeleteEmptyDevicesByTime

func (conn *MapConn) DeleteEmptyDevicesByTime(t time.Time) error

DeleteEmptyDevicesByTime is not implemented.

func (*MapConn) DeleteUser

func (conn *MapConn) DeleteUser(id string) error

DeleteUser remove an existing in UserMap.

func (*MapConn) GetAdminRoles

func (conn *MapConn) GetAdminRoles() ([]string, error)

GetAdminRoles is not implemented.

func (*MapConn) GetAsset

func (conn *MapConn) GetAsset(name string, asset *skydb.Asset) error

GetAsset is not implemented.

func (*MapConn) GetDefaultRoles

func (conn *MapConn) GetDefaultRoles() ([]string, error)

GetDefaultRoles always return user for testing

func (*MapConn) GetDevice

func (conn *MapConn) GetDevice(id string, device *skydb.Device) error

GetDevice is not implemented.

func (*MapConn) GetRecordAccess

func (conn *MapConn) GetRecordAccess(recordType string) (skydb.RecordACL, error)

GetRecordAccess returns record creation access of a specific type

func (*MapConn) GetUser

func (conn *MapConn) GetUser(id string, userinfo *skydb.UserInfo) error

GetUser returns a UserInfo in UserMap.

func (*MapConn) GetUserByPrincipalID

func (conn *MapConn) GetUserByPrincipalID(principalID string, userinfo *skydb.UserInfo) error

GetUserByPrincipalID returns a UserInfo by its principalID.

func (*MapConn) GetUserByUsernameEmail

func (conn *MapConn) GetUserByUsernameEmail(username string, email string, userinfo *skydb.UserInfo) error

GetUserByUsernameEmail returns a UserInfo in UserMap by email address.

func (*MapConn) PrivateDB

func (conn *MapConn) PrivateDB(userKey string) skydb.Database

PrivateDB is not implemented.

func (*MapConn) PublicDB

func (conn *MapConn) PublicDB() skydb.Database

PublicDB is not implemented.

func (*MapConn) QueryDevicesByUser

func (conn *MapConn) QueryDevicesByUser(user string) ([]skydb.Device, error)

QueryDevicesByUser is not implemented.

func (*MapConn) QueryRelation

func (conn *MapConn) QueryRelation(user string, name string, direction string, config skydb.QueryConfig) []skydb.UserInfo

QueryRelation is not implemented.

func (*MapConn) QueryRelationCount

func (conn *MapConn) QueryRelationCount(user string, name string, direction string) (uint64, error)

QueryRelationCount is not implemented.

func (*MapConn) QueryUser

func (conn *MapConn) QueryUser(emails []string, usernames []string) ([]skydb.UserInfo, error)

QueryUser is not implemented.

func (*MapConn) RemoveRelation

func (conn *MapConn) RemoveRelation(user string, name string, targetUser string) error

RemoveRelation is not implemented.

func (*MapConn) SaveAsset

func (conn *MapConn) SaveAsset(asset *skydb.Asset) error

SaveAsset is not implemented.

func (*MapConn) SaveDevice

func (conn *MapConn) SaveDevice(device *skydb.Device) error

SaveDevice is not implemented.

func (*MapConn) SetAdminRoles

func (conn *MapConn) SetAdminRoles(roles []string) error

SetAdminRoles is not implemented.

func (*MapConn) SetDefaultRoles

func (conn *MapConn) SetDefaultRoles(roles []string) error

SetDefaultRoles is not implemented.

func (*MapConn) SetRecordAccess

func (conn *MapConn) SetRecordAccess(recordType string, acl skydb.RecordACL) error

SetRecordAccess sets record creation access

func (*MapConn) Subscribe

func (conn *MapConn) Subscribe(recordEventChan chan skydb.RecordEvent) error

Subscribe is not implemented.

func (*MapConn) UpdateUser

func (conn *MapConn) UpdateUser(userinfo *skydb.UserInfo) error

UpdateUser updates an existing UserInfo in UserMap.

type MapDB

type MapDB struct {
	RecordMap       RecordMap
	SubscriptionMap SubscriptionMap
	RecordSchemaMap RecordSchemaMap
	DBConn          skydb.Conn
	skydb.Database
}

MapDB is a naive memory implementation of skydb.Database.

func NewMapDB

func NewMapDB() *MapDB

NewMapDB returns a new MapDB ready for use.

func (*MapDB) DatabaseType

func (db *MapDB) DatabaseType() skydb.DatabaseType

func (*MapDB) Delete

func (db *MapDB) Delete(id skydb.RecordID) error

Delete remove the specified key from RecordMap.

func (*MapDB) DeleteSchema

func (db *MapDB) DeleteSchema(recordType, columnName string) error

func (*MapDB) DeleteSubscription

func (db *MapDB) DeleteSubscription(name string, deviceID string) error

DeleteSubscription deletes the specified key from SubscriptionMap.

func (*MapDB) Extend

func (db *MapDB) Extend(recordType string, schema skydb.RecordSchema) (bool, error)

Extend store the type of the field.

func (*MapDB) Get

func (db *MapDB) Get(id skydb.RecordID, record *skydb.Record) error

Get returns a Record from RecordMap.

func (*MapDB) GetRecordSchemas

func (db *MapDB) GetRecordSchemas() (map[string]skydb.RecordSchema, error)

GetRecordSchemas returns a list of all existing record type

func (*MapDB) GetSchema

func (db *MapDB) GetSchema(recordType string) (skydb.RecordSchema, error)

GetSchema returns the record schema of a record type

func (*MapDB) GetSubscription

func (db *MapDB) GetSubscription(name string, deviceID string, subscription *skydb.Subscription) error

GetSubscription return a Subscription from SubscriptionMap.

func (*MapDB) ID

func (db *MapDB) ID() string

ID returns a mock Database ID.

func (*MapDB) IsReadOnly

func (db *MapDB) IsReadOnly() bool

func (*MapDB) Query

func (db *MapDB) Query(query *skydb.Query) (*skydb.Rows, error)

Query is not implemented.

func (*MapDB) RenameSchema

func (db *MapDB) RenameSchema(recordType, oldColumnName, newColumnName string) error

func (*MapDB) Save

func (db *MapDB) Save(record *skydb.Record) error

Save assigns Record to RecordMap.

func (*MapDB) SaveSubscription

func (db *MapDB) SaveSubscription(subscription *skydb.Subscription) error

SaveSubscription assigns to SubscriptionMap.

func (*MapDB) UserRecordType

func (db *MapDB) UserRecordType() string

type MockTxDatabase

type MockTxDatabase struct {
	DidBegin, DidCommit, DidRollback bool
	skydb.Database
}

MockTxDatabase implements and records TxDatabase's methods and delegates other calls to underlying Database

func NewMockTxDatabase

func NewMockTxDatabase(backingDB skydb.Database) *MockTxDatabase

func (*MockTxDatabase) Begin

func (db *MockTxDatabase) Begin() error

func (*MockTxDatabase) Commit

func (db *MockTxDatabase) Commit() error

func (*MockTxDatabase) Rollback

func (db *MockTxDatabase) Rollback() error

type RecordMap

type RecordMap map[string]skydb.Record

RecordMap is a string=>Record map

type RecordSchemaMap

type RecordSchemaMap map[string]skydb.RecordSchema

RecordSchemaMap is a string=>RecordSchema map

type SubscriptionMap

type SubscriptionMap map[string]skydb.Subscription

SubscriptionMap is a string=>Subscription map

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL