Documentation ¶
Index ¶
- func ExpectDBExtendSchema(db *mock_skydb.MockTxDatabase, extendedSchema skydb.RecordSchema)
- func ExpectDBSaveUser(db *mock_skydb.MockTxDatabase, extendedSchema *skydb.RecordSchema, ...)
- type MapConn
- func (conn *MapConn) AddRelation(user string, name string, targetUser string) error
- func (conn *MapConn) Close() error
- func (conn *MapConn) CreateAuth(authinfo *skydb.AuthInfo) error
- func (conn *MapConn) CreateCustomTokenInfo(tokenInfo *skydb.CustomTokenInfo) error
- func (conn *MapConn) CreateOAuthInfo(oauthinfo *skydb.OAuthInfo) (err error)
- func (conn *MapConn) DeleteAuth(id string) error
- func (conn *MapConn) DeleteCustomTokenInfo(principalID string) error
- func (conn *MapConn) DeleteDevice(id string) error
- func (conn *MapConn) DeleteDevicesByToken(token string, t time.Time) error
- func (conn *MapConn) DeleteEmptyDevicesByTime(t time.Time) error
- func (conn *MapConn) DeleteOAuth(provider string, principalID string) error
- func (conn *MapConn) EnsureAuthRecordKeysValid(authRecordKeys [][]string) error
- func (conn *MapConn) GetAdminRoles() ([]string, error)
- func (conn *MapConn) GetAsset(name string, asset *skydb.Asset) error
- func (conn *MapConn) GetAssets(names []string) ([]skydb.Asset, error)
- func (conn *MapConn) GetAuth(id string, authinfo *skydb.AuthInfo) error
- func (conn *MapConn) GetAuthByPrincipalID(principalID string, authinfo *skydb.AuthInfo) error
- func (conn *MapConn) GetCustomTokenInfo(principalID string, tokenInfo *skydb.CustomTokenInfo) error
- func (conn *MapConn) GetDefaultRoles() ([]string, error)
- func (conn *MapConn) GetDevice(id string, device *skydb.Device) error
- func (conn *MapConn) GetOAuthInfo(provider string, principalID string, oauthinfo *skydb.OAuthInfo) error
- func (conn *MapConn) GetOAuthInfoByProviderAndUserID(provider string, userID string, oauthinfo *skydb.OAuthInfo) error
- func (conn *MapConn) GetRecordAccess(recordType string) (skydb.RecordACL, error)
- func (conn *MapConn) GetRecordDefaultAccess(recordType string) (skydb.RecordACL, error)
- func (conn *MapConn) GetRecordFieldAccess() (skydb.FieldACL, error)
- func (conn *MapConn) PrivateDB(userKey string) skydb.Database
- func (conn *MapConn) PublicDB() skydb.Database
- func (conn *MapConn) QueryDevicesByUser(user string) ([]skydb.Device, error)
- func (conn *MapConn) QueryRelation(user string, name string, direction string, config skydb.QueryConfig) []skydb.AuthInfo
- func (conn *MapConn) QueryRelationCount(user string, name string, direction string) (uint64, error)
- func (conn *MapConn) RemoveRelation(user string, name string, targetUser string) error
- func (conn *MapConn) SaveAsset(asset *skydb.Asset) error
- func (conn *MapConn) SaveDevice(device *skydb.Device) error
- func (conn *MapConn) SetAdminRoles(roles []string) error
- func (conn *MapConn) SetDefaultRoles(roles []string) error
- func (conn *MapConn) SetRecordAccess(recordType string, acl skydb.RecordACL) error
- func (conn *MapConn) SetRecordDefaultAccess(recordType string, acl skydb.RecordACL) error
- func (conn *MapConn) SetRecordFieldAccess(acl skydb.FieldACL) error
- func (conn *MapConn) Subscribe(recordEventChan chan skydb.RecordEvent) error
- func (conn *MapConn) UpdateAuth(authinfo *skydb.AuthInfo) error
- func (conn *MapConn) UpdateOAuthInfo(oauthinfo *skydb.OAuthInfo) (err error)
- type MapDB
- func (db *MapDB) DatabaseType() skydb.DatabaseType
- func (db *MapDB) Delete(id skydb.RecordID) error
- func (db *MapDB) DeleteSchema(recordType, columnName string) error
- func (db *MapDB) DeleteSubscription(name string, deviceID string) error
- func (db *MapDB) Extend(recordType string, schema skydb.RecordSchema) (bool, error)
- func (db *MapDB) Get(id skydb.RecordID, record *skydb.Record) error
- func (db *MapDB) GetRecordSchemas() (map[string]skydb.RecordSchema, error)
- func (db *MapDB) GetSchema(recordType string) (skydb.RecordSchema, error)
- func (db *MapDB) GetSubscription(name string, deviceID string, subscription *skydb.Subscription) error
- func (db *MapDB) ID() string
- func (db *MapDB) IsReadOnly() bool
- func (db *MapDB) Query(query *skydb.Query, accessControlOptions *skydb.AccessControlOptions) (*skydb.Rows, error)
- func (db *MapDB) RenameSchema(recordType, oldColumnName, newColumnName string) error
- func (db *MapDB) Save(record *skydb.Record) error
- func (db *MapDB) SaveSubscription(subscription *skydb.Subscription) error
- func (db *MapDB) UserRecordType() string
- type MockTxDatabase
- type RecordMap
- type RecordSchemaMap
- type SubscriptionMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExpectDBExtendSchema ¶ added in v1.1.0
func ExpectDBExtendSchema(db *mock_skydb.MockTxDatabase, extendedSchema skydb.RecordSchema)
func ExpectDBSaveUser ¶ added in v1.1.0
func ExpectDBSaveUser(db *mock_skydb.MockTxDatabase, extendedSchema *skydb.RecordSchema, assertSavedUserRecord interface{}, saveError error)
Types ¶
type MapConn ¶
type MapConn struct { UserMap map[string]skydb.AuthInfo AssetMap map[string]skydb.Asset InternalPublicDB skydb.Database OAuthMap map[string]skydb.OAuthInfo CustomTokenInfoMap map[string]skydb.CustomTokenInfo skydb.Conn // contains filtered or unexported fields }
MapConn is a naive memory implementation of skydb.Conn
func (*MapConn) AddRelation ¶
AddRelation is not implemented.
func (*MapConn) CreateAuth ¶ added in v1.1.0
CreateAuth creates a AuthInfo in UserMap.
func (*MapConn) CreateCustomTokenInfo ¶ added in v1.3.0
func (conn *MapConn) CreateCustomTokenInfo(tokenInfo *skydb.CustomTokenInfo) error
func (*MapConn) CreateOAuthInfo ¶ added in v1.2.0
CreateOAuthInfo creates OAuthInfo in OAuthMap.
func (*MapConn) DeleteAuth ¶ added in v1.1.0
DeleteAuth remove an existing in UserMap.
func (*MapConn) DeleteCustomTokenInfo ¶ added in v1.3.0
func (*MapConn) DeleteDevice ¶
DeleteDevice is not implemented.
func (*MapConn) DeleteDevicesByToken ¶
DeleteDevicesByToken is not implemented.
func (*MapConn) DeleteEmptyDevicesByTime ¶
DeleteEmptyDevicesByTime is not implemented.
func (*MapConn) DeleteOAuth ¶ added in v1.2.0
DeleteOAuth remove an existing in OAuthMap.
func (*MapConn) EnsureAuthRecordKeysValid ¶ added in v1.1.0
func (*MapConn) GetAdminRoles ¶
GetAdminRoles is not implemented.
func (*MapConn) GetAuthByPrincipalID ¶ added in v1.1.0
GetAuthByPrincipalID returns a AuthInfo by its principalID.
func (*MapConn) GetCustomTokenInfo ¶ added in v1.3.0
func (conn *MapConn) GetCustomTokenInfo(principalID string, tokenInfo *skydb.CustomTokenInfo) error
func (*MapConn) GetDefaultRoles ¶
GetDefaultRoles always return user for testing
func (*MapConn) GetOAuthInfo ¶ added in v1.2.0
func (conn *MapConn) GetOAuthInfo(provider string, principalID string, oauthinfo *skydb.OAuthInfo) error
GetOAuthInfo returns OAuthInfo by provider and principalID.
func (*MapConn) GetOAuthInfoByProviderAndUserID ¶ added in v1.2.0
func (conn *MapConn) GetOAuthInfoByProviderAndUserID(provider string, userID string, oauthinfo *skydb.OAuthInfo) error
GetOAuthInfoByProviderAndUserID returns OAuthInfo by provider and userID.
func (*MapConn) GetRecordAccess ¶
GetRecordAccess returns record creation access of a specific type
func (*MapConn) GetRecordDefaultAccess ¶ added in v0.23.0
GetRecordDefaultAccess returns record default access of a specific type
func (*MapConn) GetRecordFieldAccess ¶ added in v1.1.0
GetRecordFieldAccess returns record field access for all types
func (*MapConn) QueryDevicesByUser ¶
QueryDevicesByUser is not implemented.
func (*MapConn) QueryRelation ¶
func (conn *MapConn) QueryRelation(user string, name string, direction string, config skydb.QueryConfig) []skydb.AuthInfo
QueryRelation is not implemented.
func (*MapConn) QueryRelationCount ¶
QueryRelationCount is not implemented.
func (*MapConn) RemoveRelation ¶
RemoveRelation is not implemented.
func (*MapConn) SaveDevice ¶
SaveDevice is not implemented.
func (*MapConn) SetAdminRoles ¶
SetAdminRoles is not implemented.
func (*MapConn) SetDefaultRoles ¶
SetDefaultRoles is not implemented.
func (*MapConn) SetRecordAccess ¶
SetRecordAccess sets record creation access
func (*MapConn) SetRecordDefaultAccess ¶ added in v0.23.0
SetRecordDefaultAccess sets record creation access
func (*MapConn) SetRecordFieldAccess ¶ added in v1.1.0
SetRecordFieldAccess sets record field access for all types
func (*MapConn) Subscribe ¶
func (conn *MapConn) Subscribe(recordEventChan chan skydb.RecordEvent) error
Subscribe is not implemented.
func (*MapConn) UpdateAuth ¶ added in v1.1.0
UpdateAuth updates an existing AuthInfo 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 (*MapDB) DatabaseType ¶
func (db *MapDB) DatabaseType() skydb.DatabaseType
func (*MapDB) DeleteSchema ¶
func (*MapDB) DeleteSubscription ¶
DeleteSubscription deletes the specified key from SubscriptionMap.
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) IsReadOnly ¶
func (*MapDB) Query ¶
func (db *MapDB) Query(query *skydb.Query, accessControlOptions *skydb.AccessControlOptions) (*skydb.Rows, error)
Query is not implemented.
func (*MapDB) RenameSchema ¶
func (*MapDB) SaveSubscription ¶
func (db *MapDB) SaveSubscription(subscription *skydb.Subscription) error
SaveSubscription assigns to SubscriptionMap.
func (*MapDB) UserRecordType ¶
type MockTxDatabase ¶
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 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