Documentation
¶
Overview ¶
Package goext is a generated GoMock package.
Index ¶
- Constants
- Variables
- func GetContext(requestContext Context) context.Context
- func IsDeadlock(err error) bool
- type Context
- func (ctx Context) Clone() Context
- func (ctx Context) WithISchema(schema ISchema) Context
- func (ctx Context) WithResource(resource Resource) Context
- func (ctx Context) WithResourceID(resourceID string) Context
- func (ctx Context) WithSchemaID(schemaID SchemaID) Context
- func (ctx Context) WithTransaction(tx ITransaction) Context
- type CustomEvent
- type DbOptions
- type Error
- func NewError(status int, err error) *Error
- func NewErrorAccepted(err error) *Error
- func NewErrorAlreadyReported(err error) *Error
- func NewErrorBadGateway(err error) *Error
- func NewErrorBadRequest(err error) *Error
- func NewErrorConflict(err error) *Error
- func NewErrorContinue(err error) *Error
- func NewErrorCreated(err error) *Error
- func NewErrorExpectationFailed(err error) *Error
- func NewErrorFailedDependency(err error) *Error
- func NewErrorForbidden(err error) *Error
- func NewErrorFound(err error) *Error
- func NewErrorGatewayTimeout(err error) *Error
- func NewErrorGone(err error) *Error
- func NewErrorHTTPVersionNotSupported(err error) *Error
- func NewErrorIMUsed(err error) *Error
- func NewErrorInsufficientStorage(err error) *Error
- func NewErrorInternalServerError(err error) *Error
- func NewErrorLengthRequired(err error) *Error
- func NewErrorLocked(err error) *Error
- func NewErrorLoopDetected(err error) *Error
- func NewErrorMethodNotAllowed(err error) *Error
- func NewErrorMovedPermanently(err error) *Error
- func NewErrorMultiStatus(err error) *Error
- func NewErrorMultipleChoices(err error) *Error
- func NewErrorNetworkAuthenticationRequired(err error) *Error
- func NewErrorNoContent(err error) *Error
- func NewErrorNonAuthoritativeInfo(err error) *Error
- func NewErrorNotAcceptable(err error) *Error
- func NewErrorNotExtended(err error) *Error
- func NewErrorNotFound(err error) *Error
- func NewErrorNotImplemented(err error) *Error
- func NewErrorNotModified(err error) *Error
- func NewErrorOK(err error) *Error
- func NewErrorPartialContent(err error) *Error
- func NewErrorPaymentRequired(err error) *Error
- func NewErrorPermanentRedirect(err error) *Error
- func NewErrorPreconditionFailed(err error) *Error
- func NewErrorPreconditionRequired(err error) *Error
- func NewErrorProcessing(err error) *Error
- func NewErrorProxyAuthRequired(err error) *Error
- func NewErrorRequestEntityTooLarge(err error) *Error
- func NewErrorRequestHeaderFieldsTooLarge(err error) *Error
- func NewErrorRequestTimeout(err error) *Error
- func NewErrorRequestURITooLong(err error) *Error
- func NewErrorRequestedRangeNotSatisfiable(err error) *Error
- func NewErrorResetContent(err error) *Error
- func NewErrorSeeOther(err error) *Error
- func NewErrorServiceUnavailable(err error) *Error
- func NewErrorSwitchingProtocols(err error) *Error
- func NewErrorTeapot(err error) *Error
- func NewErrorTemporaryRedirect(err error) *Error
- func NewErrorTooManyRequests(err error) *Error
- func NewErrorUnauthorized(err error) *Error
- func NewErrorUnavailableForLegalReasons(err error) *Error
- func NewErrorUnprocessableEntity(err error) *Error
- func NewErrorUnsupportedMediaType(err error) *Error
- func NewErrorUpgradeRequired(err error) *Error
- func NewErrorUseProxy(err error) *Error
- func NewErrorVariantAlsoNegotiates(err error) *Error
- type Event
- type Filter
- type Handler
- type Header
- type IAuth
- type IConfig
- type ICore
- type IDatabase
- type IEnvironment
- type IHTTP
- type ILogger
- type IResourceBase
- type ISchema
- type ISchemas
- type ISync
- type ITransaction
- type IUtil
- type Level
- type ListOptions
- type LockPolicy
- type Maybe
- type MaybeBool
- type MaybeFloat
- type MaybeInt
- type MaybeState
- type MaybeString
- type MockIAuth
- type MockIAuthMockRecorder
- type MockIConfig
- type MockIConfigMockRecorder
- type MockICore
- func (m *MockICore) EXPECT() *MockICoreMockRecorder
- func (m *MockICore) HandleEvent(arg0 string, arg1 Context) error
- func (m *MockICore) RegisterEventHandler(arg0 string, arg1 Handler, arg2 int)
- func (m *MockICore) RegisterSchemaEventHandler(arg0 SchemaID, arg1 string, arg2 SchemaHandler, arg3 int)
- func (m *MockICore) TriggerEvent(arg0 string, arg1 Context) error
- type MockICoreMockRecorder
- func (mr *MockICoreMockRecorder) HandleEvent(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockICoreMockRecorder) RegisterEventHandler(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockICoreMockRecorder) RegisterSchemaEventHandler(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockICoreMockRecorder) TriggerEvent(arg0, arg1 interface{}) *gomock.Call
- type MockIDatabase
- func (m *MockIDatabase) Begin() (ITransaction, error)
- func (m *MockIDatabase) BeginTx(arg0 Context, arg1 *TxOptions) (ITransaction, error)
- func (m *MockIDatabase) EXPECT() *MockIDatabaseMockRecorder
- func (m *MockIDatabase) Options() DbOptions
- func (m *MockIDatabase) Within(arg0 Context, arg1 func(ITransaction) error) error
- func (m *MockIDatabase) WithinTx(arg0 Context, arg1 *TxOptions, arg2 func(ITransaction) error) error
- type MockIDatabaseMockRecorder
- func (mr *MockIDatabaseMockRecorder) Begin() *gomock.Call
- func (mr *MockIDatabaseMockRecorder) BeginTx(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockIDatabaseMockRecorder) Options() *gomock.Call
- func (mr *MockIDatabaseMockRecorder) Within(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockIDatabaseMockRecorder) WithinTx(arg0, arg1, arg2 interface{}) *gomock.Call
- type MockIEnvironment
- type MockIHTTP
- func (m *MockIHTTP) EXPECT() *MockIHTTPMockRecorder
- func (m *MockIHTTP) Request(arg0 context.Context, arg1, arg2 string, arg3 map[string]interface{}, ...) (*Response, error)
- func (m *MockIHTTP) RequestRaw(arg0 context.Context, arg1, arg2 string, arg3 map[string]string, arg4 string) (*Response, error)
- type MockIHTTPMockRecorder
- type MockILogger
- func (m *MockILogger) Critical(arg0 string)
- func (m *MockILogger) Criticalf(arg0 string, arg1 ...interface{})
- func (m *MockILogger) Debug(arg0 string)
- func (m *MockILogger) Debugf(arg0 string, arg1 ...interface{})
- func (m *MockILogger) EXPECT() *MockILoggerMockRecorder
- func (m *MockILogger) Error(arg0 string)
- func (m *MockILogger) Errorf(arg0 string, arg1 ...interface{})
- func (m *MockILogger) Info(arg0 string)
- func (m *MockILogger) Infof(arg0 string, arg1 ...interface{})
- func (m *MockILogger) Notice(arg0 string)
- func (m *MockILogger) Noticef(arg0 string, arg1 ...interface{})
- func (m *MockILogger) Warning(arg0 string)
- func (m *MockILogger) Warningf(arg0 string, arg1 ...interface{})
- type MockILoggerMockRecorder
- func (mr *MockILoggerMockRecorder) Critical(arg0 interface{}) *gomock.Call
- func (mr *MockILoggerMockRecorder) Criticalf(arg0 interface{}, arg1 ...interface{}) *gomock.Call
- func (mr *MockILoggerMockRecorder) Debug(arg0 interface{}) *gomock.Call
- func (mr *MockILoggerMockRecorder) Debugf(arg0 interface{}, arg1 ...interface{}) *gomock.Call
- func (mr *MockILoggerMockRecorder) Error(arg0 interface{}) *gomock.Call
- func (mr *MockILoggerMockRecorder) Errorf(arg0 interface{}, arg1 ...interface{}) *gomock.Call
- func (mr *MockILoggerMockRecorder) Info(arg0 interface{}) *gomock.Call
- func (mr *MockILoggerMockRecorder) Infof(arg0 interface{}, arg1 ...interface{}) *gomock.Call
- func (mr *MockILoggerMockRecorder) Notice(arg0 interface{}) *gomock.Call
- func (mr *MockILoggerMockRecorder) Noticef(arg0 interface{}, arg1 ...interface{}) *gomock.Call
- func (mr *MockILoggerMockRecorder) Warning(arg0 interface{}) *gomock.Call
- func (mr *MockILoggerMockRecorder) Warningf(arg0 interface{}, arg1 ...interface{}) *gomock.Call
- type MockISchemas
- type MockISchemasMockRecorder
- type MockISync
- func (m *MockISync) Delete(arg0 string, arg1 bool) error
- func (m *MockISync) EXPECT() *MockISyncMockRecorder
- func (m *MockISync) Fetch(arg0 string) (*Node, error)
- func (m *MockISync) Update(arg0, arg1 string) error
- func (m *MockISync) Watch(arg0 context.Context, arg1 string, arg2 time.Duration, arg3 int64) ([]*Event, error)
- type MockISyncMockRecorder
- func (mr *MockISyncMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockISyncMockRecorder) Fetch(arg0 interface{}) *gomock.Call
- func (mr *MockISyncMockRecorder) Update(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockISyncMockRecorder) Watch(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- type MockITransaction
- func (m *MockITransaction) Close() error
- func (m *MockITransaction) Closed() bool
- func (m *MockITransaction) Commit() error
- func (m *MockITransaction) Count(arg0 context.Context, arg1 ISchema, arg2 Filter) (uint64, error)
- func (m *MockITransaction) Create(arg0 context.Context, arg1 ISchema, arg2 map[string]interface{}) error
- func (m *MockITransaction) Delete(arg0 context.Context, arg1 ISchema, arg2 interface{}) error
- func (m *MockITransaction) EXPECT() *MockITransactionMockRecorder
- func (m *MockITransaction) Exec(arg0 context.Context, arg1 string, arg2 ...interface{}) error
- func (m *MockITransaction) Fetch(arg0 context.Context, arg1 ISchema, arg2 Filter) (map[string]interface{}, error)
- func (m *MockITransaction) GetIsolationLevel() Type
- func (m *MockITransaction) List(arg0 context.Context, arg1 ISchema, arg2 Filter, arg3 *ListOptions, ...) ([]map[string]interface{}, uint64, error)
- func (m *MockITransaction) LockFetch(arg0 context.Context, arg1 ISchema, arg2 Filter, arg3 LockPolicy) (map[string]interface{}, error)
- func (m *MockITransaction) LockList(arg0 context.Context, arg1 ISchema, arg2 Filter, arg3 *ListOptions, ...) ([]map[string]interface{}, uint64, error)
- func (m *MockITransaction) Query(arg0 context.Context, arg1 ISchema, arg2 string, arg3 []interface{}) ([]map[string]interface{}, error)
- func (m *MockITransaction) RawTransaction() interface{}
- func (m *MockITransaction) StateFetch(arg0 context.Context, arg1 ISchema, arg2 Filter) (ResourceState, error)
- func (m *MockITransaction) StateUpdate(arg0 context.Context, arg1 ISchema, arg2 map[string]interface{}, ...) error
- func (m *MockITransaction) Update(arg0 context.Context, arg1 ISchema, arg2 map[string]interface{}) error
- type MockITransactionMockRecorder
- func (mr *MockITransactionMockRecorder) Close() *gomock.Call
- func (mr *MockITransactionMockRecorder) Closed() *gomock.Call
- func (mr *MockITransactionMockRecorder) Commit() *gomock.Call
- func (mr *MockITransactionMockRecorder) Count(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockITransactionMockRecorder) Create(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockITransactionMockRecorder) Delete(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockITransactionMockRecorder) Exec(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
- func (mr *MockITransactionMockRecorder) Fetch(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockITransactionMockRecorder) GetIsolationLevel() *gomock.Call
- func (mr *MockITransactionMockRecorder) List(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call
- func (mr *MockITransactionMockRecorder) LockFetch(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockITransactionMockRecorder) LockList(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call
- func (mr *MockITransactionMockRecorder) Query(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockITransactionMockRecorder) RawTransaction() *gomock.Call
- func (mr *MockITransactionMockRecorder) StateFetch(arg0, arg1, arg2 interface{}) *gomock.Call
- func (mr *MockITransactionMockRecorder) StateUpdate(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
- func (mr *MockITransactionMockRecorder) Update(arg0, arg1, arg2 interface{}) *gomock.Call
- type MockIUtil
- func (m *MockIUtil) EXPECT() *MockIUtilMockRecorder
- func (m *MockIUtil) GetTransaction(arg0 Context) (ITransaction, bool)
- func (m *MockIUtil) NewUUID() string
- func (m *MockIUtil) ResourceFromMapForType(arg0 map[string]interface{}, arg1 interface{}) (Resource, error)
- func (m *MockIUtil) ResourceToMap(arg0 interface{}) map[string]interface{}
- type MockIUtilMockRecorder
- func (mr *MockIUtilMockRecorder) GetTransaction(arg0 interface{}) *gomock.Call
- func (mr *MockIUtilMockRecorder) NewUUID() *gomock.Call
- func (mr *MockIUtilMockRecorder) ResourceFromMapForType(arg0, arg1 interface{}) *gomock.Call
- func (mr *MockIUtilMockRecorder) ResourceToMap(arg0 interface{}) *gomock.Call
- type MockModules
- type Node
- type OptionPaginator
- type Paginator
- type Property
- type Resource
- type ResourceBase
- type ResourceEvent
- type ResourceState
- type Resources
- type Response
- type SchemaHandler
- type SchemaID
- type SchemaRelationInfo
- type TxOptions
- type Type
Constants ¶
const (
KeyTopLevelHandler = "top_level_handler"
)
const PriorityDefault = 0
PriorityDefault is a default handler priority
Variables ¶
var ErrResourceNotFound = errors.New("resource not found")
ErrResourceNotFound represents 'resource not found' error
Functions ¶
func GetContext ¶
GetContext returns golang context from the goext requestContext
Types ¶
type Context ¶
type Context map[string]interface{}
Context represents a context of a handler
func (Context) WithISchema ¶
WithISchema appends ISchema to given context
func (Context) WithResource ¶
WithResource appends resource to given context
func (Context) WithResourceID ¶
WithResourceID appends resource ID to given context
func (Context) WithSchemaID ¶
WithSchemaID appends schema ID to given context
func (Context) WithTransaction ¶
func (ctx Context) WithTransaction(tx ITransaction) Context
WithTransaction appends transaction to given context
type CustomEvent ¶
type CustomEvent string
type DbOptions ¶
DbOptions represent database options
func DefaultDbOptions ¶
func DefaultDbOptions() DbOptions
DefaultDbOptions returns default database options: no retries at all
type Error ¶
Error represents an error code with related HTTP status
func NewErrorAccepted ¶
func NewErrorAlreadyReported ¶
func NewErrorBadGateway ¶
func NewErrorConflict ¶
func NewErrorCreated ¶
func NewErrorForbidden ¶
func NewErrorFound ¶
func NewErrorGatewayTimeout ¶
func NewErrorGone ¶
func NewErrorIMUsed ¶
func NewErrorLengthRequired ¶
func NewErrorLocked ¶
func NewErrorLoopDetected ¶
func NewErrorMultiStatus ¶
func NewErrorNoContent ¶
func NewErrorNotAcceptable ¶
func NewErrorNotExtended ¶
func NewErrorNotFound ¶
func NewErrorNotImplemented ¶
func NewErrorNotModified ¶
func NewErrorPartialContent ¶
func NewErrorPaymentRequired ¶
func NewErrorProcessing ¶
func NewErrorRequestTimeout ¶
func NewErrorResetContent ¶
func NewErrorSeeOther ¶
func NewErrorTeapot ¶
func NewErrorTooManyRequests ¶
func NewErrorUnauthorized ¶
func NewErrorUpgradeRequired ¶
func NewErrorUseProxy ¶
func (Error) ErrorStack ¶
ErrorStack returns formatted full error stack message
type Filter ¶
type Filter map[string]interface{}
Filter represents filtering options for fetching functions
type Handler ¶
type Handler func(context Context, environment IEnvironment) *Error
Handler is a generic handler
type IAuth ¶
type IAuth interface { // HasRole reports whether context has given role HasRole(context Context, role string) bool // GetTenantName return name from the given context GetTenantName(context Context) string // IsAdmin reports whether context belongs to admin IsAdmin(context Context) bool }
IAuth is an interface to auth in Gohan
type IConfig ¶
type IConfig interface { // Config gets a parameter from config Config(key string, defaultValue interface{}) interface{} }
IConfig is an interface to config in Gohan
type ICore ¶
type ICore interface { // TriggerEvent causes the given event to be handled in all environments (across different-language extensions) TriggerEvent(event string, context Context) error // HandleEvent Causes the given event to be handled within the same environment HandleEvent(event string, context Context) error // RegisterEventHandler registers a global handler RegisterEventHandler(event string, handler Handler, priority int) // RegisterSchemaEventHandler registers a schema handler RegisterSchemaEventHandler(schemaID SchemaID, event string, schemaHandler SchemaHandler, priority int) }
ICore is an interface to core parts of Gohan: event triggering and registering
type IDatabase ¶
type IDatabase interface { // Begin starts a new transaction Begin() (ITransaction, error) // BeginTx starts a new transaction with options BeginTx(context Context, options *TxOptions) (ITransaction, error) // Options return database options from the configuration file Options() DbOptions // Within calls a function in a scoped transaction Within(context Context, fn func(tx ITransaction) error) error // WithinTx calls a function in a scoped transaction with options WithinTx(context Context, options *TxOptions, fn func(tx ITransaction) error) error }
IDatabase is an interface to database in Gohan
type IEnvironment ¶
type IEnvironment interface { // Config returns an implementation of IConfig interface Config() IConfig // Core returns an implementation of ICore interface Core() ICore // Logger returns an implementation of ILogger interface Logger() ILogger // Schemas returns an implementation of ISchemas interface Schemas() ISchemas // Sync returns an implementation of ISync interface Sync() ISync // Database returns an implementation of IIDatabase interface Database() IDatabase // HTTP returns an implementation of IIHTTP interface HTTP() IHTTP // Auth returns an implementation of IIAuth interface Auth() IAuth // Util returns an implementation of IIUtil interface Util() IUtil // Reset clears the environment to its initial state Reset() }
IEnvironment is the only scope of Gohan available for a go extensions; other packages must not be imported nor used
type IHTTP ¶
type IHTTP interface { // Request performs http request Request(ctx context.Context, method, rawURL string, headers map[string]interface{}, postData interface{}, opaque bool) (*Response, error) // RequestRaw performs raw http request RequestRaw(ctx context.Context, method, rawURL string, headers map[string]string, rawData string) (*Response, error) }
IHTTP is an interface to http in Gohan
type ILogger ¶
type ILogger interface { // Critical emits a critical log message Critical(format string) // Criticalf emits a formatted critical log message Criticalf(format string, args ...interface{}) // Error emits an error log message Error(format string) // Errorf emits a formatted error log message Errorf(format string, args ...interface{}) // Warning emits a warning log message Warning(format string) // Warningf emits a formatted warning log message Warningf(format string, args ...interface{}) // Notice emits a notice log message Notice(format string) // Noticef emits a formatted notice log message Noticef(format string, args ...interface{}) // Info emits an info log message Info(format string) // Infof emits a formatted info log message Infof(format string, args ...interface{}) // Debug emits a debug log message Debug(format string) // Debugf emits a formatted debug log message Debugf(format string, args ...interface{}) }
ILogger is an interface to logger in Gohan
type IResourceBase ¶
type IResourceBase interface { // Environment returns an implementation of IEnvironment interface Environment() IEnvironment // Schema returns an implementation of ISchema interface Schema() ISchema // Logger returns an implementation of ILogger interface Logger() ILogger }
IResourceBase is the base class for all resources
type ISchema ¶
type ISchema interface { // ID returns the identifier of this resource ID() SchemaID // List returns a list of pointers to resources derived from BaseResource List(filter Filter, paginator *Paginator, context Context) ([]interface{}, error) // ListRaw returns a list of pointers to raw resources, containing db annotations ListRaw(filter Filter, paginator *Paginator, context Context) ([]interface{}, error) // LockList returns a list of pointers to locked resources derived from BaseResource LockList(filter Filter, paginator *Paginator, context Context, lockPolicy LockPolicy) ([]interface{}, error) // LockListRaw returns a list of pointers to locked raw resources, containing db annotations LockListRaw(filter Filter, paginator *Paginator, context Context, lockPolicy LockPolicy) ([]interface{}, error) // Count returns number of resources matching the filter Count(filter Filter, context Context) (uint64, error) // Fetch returns a pointer to resource derived from BaseResource Fetch(id string, context Context) (interface{}, error) // FetchRaw returns a pointer to raw resource, containing db annotations FetchRaw(id string, context Context) (interface{}, error) // FetchFilter returns a pointer to resource derived from BaseResource FetchFilter(filter Filter, context Context) (interface{}, error) // FetchFilterRaw returns a pointer to raw resource, containing db annotations FetchFilterRaw(filter Filter, context Context) (interface{}, error) // StateFetchRaw returns a resource state StateFetchRaw(id string, requestContext Context) (ResourceState, error) // LockFetch returns a pointer to locked resource derived from BaseResource, containing db annotations LockFetch(id string, context Context, lockPolicy LockPolicy) (interface{}, error) // LockFetchRaw returns a pointer to locked raw resource, containing db annotations LockFetchRaw(id string, context Context, lockPolicy LockPolicy) (interface{}, error) // LockFetchFilter returns a pointer to locked resource derived from BaseResource, containing db annotations LockFetchFilter(filter Filter, context Context, lockPolicy LockPolicy) (interface{}, error) // LockFetchFilterRaw returns a pointer to locked raw resource, containing db annotations LockFetchFilterRaw(filter Filter, context Context, lockPolicy LockPolicy) (interface{}, error) // CreateRaw creates a raw resource, given by a pointer CreateRaw(rawResource interface{}, context Context) error // DbCreateRaw creates a raw resource, given by a pointer, no events are emitted DbCreateRaw(rawResource interface{}, context Context) error // UpdateRaw updates a raw resource, given by a pointer UpdateRaw(rawResource interface{}, context Context) error // DbUpdateRaw updates a raw resource, given by a pointer, no events are emitted DbUpdateRaw(rawResource interface{}, context Context) error // DbStateUpdateRaw updates state of a raw resource DbStateUpdateRaw(rawResource interface{}, context Context, state *ResourceState) error // DeleteRaw deletes a raw resource, given by id DeleteRaw(id string, context Context) error // DbDeleteRaw deletes a raw resource, given by id, no events are emitted DbDeleteRaw(id string, context Context) error // DeleteFilterRaw deletes a raw resource, given by a filter DeleteFilterRaw(filter Filter, context Context) error // DbDeleteFilterRaw deletes a raw resource, given by a filter, no events are emitted DbDeleteFilterRaw(filter Filter, context Context) error // RegisterResourceEventHandler registers an event handler with resource for a named event with given priority RegisterResourceEventHandler(event ResourceEvent, schemaHandler SchemaHandler, priority int) // RegisterCustomEventHandler registers an event handler without resource for a custom event with given priority RegisterCustomEventHandler(event CustomEvent, handler Handler, priority int) // RegisterType registers a resource type, derived from IResourceBase // // Deprecated: use RegisterTypes instead RegisterType(resourceType IResourceBase) // RegisterRawType registers a raw resource type, containing db annotations // // Deprecated: use RegisterTypes instead RegisterRawType(rawResourceType interface{}) // RegisterTypes registers both resource types derived from IResourceBase and raw containing db annotations RegisterTypes(rawResourceType interface{}, resourceType IResourceBase) // ResourceFromMap converts mapped representation to structure representation of the raw resource registered for schema ResourceFromMap(context map[string]interface{}) (Resource, error) RawSchema() interface{} // DerivedSchemas returns list of schemas that extend schema with given id DerivedSchemas() []ISchema // ColumnNames generates an array that has Gohan style column names ColumnNames() []string // Properties returns properties of schema Properties() []Property // Extends return list of schema_ids which given schema extends Extends() []SchemaID }
ISchema is an interface representing a single schema in Gohan
type ISchemas ¶
type ISchemas interface { // List returns a list of loaded schemas List() []ISchema // Find returns a schema by id or nil if not found Find(id SchemaID) ISchema // Relations returns list of information about schema relations Relations(id SchemaID) []SchemaRelationInfo }
ISchemas is an interface to schemas manager in Gohan
type ISync ¶
type ISync interface { // Fetch fetches a path from sync Fetch(path string) (*Node, error) // Delete deletes a path from sync Delete(path string, prefix bool) error // Watch watches a single path in sync Watch(ctx context.Context, path string, timeout time.Duration, revision int64) ([]*Event, error) // Update updates a path with given json Update(path string, json string) error }
ISync is an interface to sync in Gohan
type ITransaction ¶
type ITransaction interface { // Create creates a new resource Create(ctx context.Context, schema ISchema, resource map[string]interface{}) error // Update updates an existing resource Update(ctx context.Context, schema ISchema, resource map[string]interface{}) error // StateUpdate updates state of an existing resource StateUpdate(ctx context.Context, schema ISchema, resource map[string]interface{}, state *ResourceState) error // Delete deletes an existing resource Delete(ctx context.Context, schema ISchema, resourceID interface{}) error // Fetch fetches an existing resource Fetch(ctx context.Context, schema ISchema, filter Filter) (map[string]interface{}, error) // LockFetch locks and fetches an existing resource LockFetch(ctx context.Context, schema ISchema, filter Filter, lockPolicy LockPolicy) (map[string]interface{}, error) // StateFetch fetches the state of an existing resource StateFetch(ctx context.Context, schema ISchema, filter Filter) (ResourceState, error) // List lists existing resources List(ctx context.Context, schema ISchema, filter Filter, listOptions *ListOptions, paginator *Paginator) ([]map[string]interface{}, uint64, error) // LockList locks and lists existing resources LockList(ctx context.Context, schema ISchema, filter Filter, listOptions *ListOptions, paginator *Paginator, lockPolicy LockPolicy) ([]map[string]interface{}, uint64, error) // Count returns number of resources matching the filter Count(ctx context.Context, schema ISchema, filter Filter) (uint64, error) // RawTransaction returns the raw transaction RawTransaction() interface{} // *sqlx.Tx // Query executes a query Query(ctx context.Context, schema ISchema, query string, args []interface{}) (list []map[string]interface{}, err error) // Commit performs a commit of the transaction Commit() error // Exec performs an exec in transaction Exec(ctx context.Context, query string, args ...interface{}) error // Close closes the transaction Close() error // Closed return whether the transaction is closed Closed() bool // GetIsolationLevel returns the isolation level of the transaction GetIsolationLevel() Type }
ITransaction is common interface for handling transaction
type IUtil ¶
type IUtil interface { // NewUUID create a new unique ID NewUUID() string // GetTransaction returns transaction from given context GetTransaction(context Context) (ITransaction, bool) // ResourceFromMapForType converts mapped representation to structure representation of the resource for given type ResourceFromMapForType(context map[string]interface{}, rawResource interface{}) (Resource, error) // ResourceToMap converts structure representation of the resource to mapped representation ResourceToMap(resource interface{}) map[string]interface{} }
type Level ¶
type Level int
Level represent logger message level
const ( // LevelCritical indicates critical level logger message LevelCritical Level = iota // LevelError indicates error level logger message LevelError // LevelWarning indicates warning level logger message LevelWarning // LevelNotice indicates notice level logger message LevelNotice // LevelInfo indicates info level logger message LevelInfo // LevelDebug indicates debug level logger message LevelDebug )
type ListOptions ¶
type ListOptions struct { // Details specifies if all the underlying structures should be // returned. Details bool // Fields limits list output to only showing selected fields. Fields []string }
ListOptions specifies additional list related options.
type LockPolicy ¶
type LockPolicy int
LockPolicy indicates lock policy
const ( // LockRelatedResources indicates that related resources are also locked LockRelatedResources LockPolicy = iota // SkipRelatedResources indicates that related resources are not locked SkipRelatedResources // NoLock indicates that no lock is acquired at all NoLock )
type Maybe ¶
type Maybe struct {
MaybeState MaybeState
}
func (Maybe) IsUndefined ¶
IsUndefined returns whether value is undefined
type MaybeBool ¶
type MaybeBool struct { Maybe // contains filtered or unexported fields }
MaybeBool represents 3-valued bool
func MakeUndefinedBool ¶
func MakeUndefinedBool() MaybeBool
MakeUndefinedBool allocates a new MaybeBool with undefined value
func (MaybeBool) MarshalJSON ¶
func (*MaybeBool) UnmarshalJSON ¶
type MaybeFloat ¶
type MaybeFloat struct { Maybe // contains filtered or unexported fields }
MaybeFloat represents 3-valued float
func MakeFloat ¶
func MakeFloat(value float64) MaybeFloat
MakeFloat allocates a new MaybeFloat and sets its value
func MakeUndefinedFloat ¶
func MakeUndefinedFloat() MaybeFloat
MakeUndefinedFloat allocates a new MaybeFloat with undefined value
func (MaybeFloat) Equals ¶
func (mf MaybeFloat) Equals(other MaybeFloat) bool
Equals returns whether two maybe values are equal
func (MaybeFloat) MarshalJSON ¶
func (mf MaybeFloat) MarshalJSON() ([]byte, error)
func (MaybeFloat) String ¶
func (m MaybeFloat) String() string
func (*MaybeFloat) UnmarshalJSON ¶
func (mf *MaybeFloat) UnmarshalJSON(b []byte) error
func (MaybeFloat) Value ¶
func (mf MaybeFloat) Value() float64
type MaybeInt ¶
type MaybeInt struct { Maybe // contains filtered or unexported fields }
MaybeInt represents 3-valued int
func MakeUndefinedInt ¶
func MakeUndefinedInt() MaybeInt
MakeUndefinedInt allocates a new MaybeInt with undefined value
func (MaybeInt) MarshalJSON ¶
func (*MaybeInt) UnmarshalJSON ¶
type MaybeState ¶
type MaybeState int
const ( MaybeUndefined MaybeState = iota MaybeNull MaybeValue )
type MaybeString ¶
type MaybeString struct { Maybe // contains filtered or unexported fields }
MaybeString represents 3-valued string
func MakeString ¶
func MakeString(value string) MaybeString
MakeString allocates a new MaybeString and sets its value
func MakeUndefinedString ¶
func MakeUndefinedString() MaybeString
MakeUndefinedString allocates a new MaybeString with undefined value
func (MaybeString) Equals ¶
func (this MaybeString) Equals(other MaybeString) bool
Equals returns whether two maybe values are equal
func (MaybeString) MarshalJSON ¶
func (ms MaybeString) MarshalJSON() ([]byte, error)
func (MaybeString) String ¶
func (m MaybeString) String() string
func (*MaybeString) UnmarshalJSON ¶
func (ms *MaybeString) UnmarshalJSON(b []byte) error
func (MaybeString) Value ¶
func (ms MaybeString) Value() string
type MockIAuth ¶
type MockIAuth struct {
// contains filtered or unexported fields
}
MockIAuth is a mock of IAuth interface
func NewMockIAuth ¶
func NewMockIAuth(ctrl *gomock.Controller) *MockIAuth
NewMockIAuth creates a new mock instance
func (*MockIAuth) EXPECT ¶
func (m *MockIAuth) EXPECT() *MockIAuthMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockIAuth) GetTenantName ¶
GetTenantName mocks base method
type MockIAuthMockRecorder ¶
type MockIAuthMockRecorder struct {
// contains filtered or unexported fields
}
MockIAuthMockRecorder is the mock recorder for MockIAuth
func (*MockIAuthMockRecorder) GetTenantName ¶
func (mr *MockIAuthMockRecorder) GetTenantName(arg0 interface{}) *gomock.Call
GetTenantName indicates an expected call of GetTenantName
func (*MockIAuthMockRecorder) HasRole ¶
func (mr *MockIAuthMockRecorder) HasRole(arg0, arg1 interface{}) *gomock.Call
HasRole indicates an expected call of HasRole
func (*MockIAuthMockRecorder) IsAdmin ¶
func (mr *MockIAuthMockRecorder) IsAdmin(arg0 interface{}) *gomock.Call
IsAdmin indicates an expected call of IsAdmin
type MockIConfig ¶
type MockIConfig struct {
// contains filtered or unexported fields
}
MockIConfig is a mock of IConfig interface
func NewMockIConfig ¶
func NewMockIConfig(ctrl *gomock.Controller) *MockIConfig
NewMockIConfig creates a new mock instance
func (*MockIConfig) Config ¶
func (m *MockIConfig) Config(arg0 string, arg1 interface{}) interface{}
Config mocks base method
func (*MockIConfig) EXPECT ¶
func (m *MockIConfig) EXPECT() *MockIConfigMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
type MockIConfigMockRecorder ¶
type MockIConfigMockRecorder struct {
// contains filtered or unexported fields
}
MockIConfigMockRecorder is the mock recorder for MockIConfig
func (*MockIConfigMockRecorder) Config ¶
func (mr *MockIConfigMockRecorder) Config(arg0, arg1 interface{}) *gomock.Call
Config indicates an expected call of Config
type MockICore ¶
type MockICore struct {
// contains filtered or unexported fields
}
MockICore is a mock of ICore interface
func NewMockICore ¶
func NewMockICore(ctrl *gomock.Controller) *MockICore
NewMockICore creates a new mock instance
func (*MockICore) EXPECT ¶
func (m *MockICore) EXPECT() *MockICoreMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockICore) HandleEvent ¶
HandleEvent mocks base method
func (*MockICore) RegisterEventHandler ¶
RegisterEventHandler mocks base method
func (*MockICore) RegisterSchemaEventHandler ¶
func (m *MockICore) RegisterSchemaEventHandler(arg0 SchemaID, arg1 string, arg2 SchemaHandler, arg3 int)
RegisterSchemaEventHandler mocks base method
type MockICoreMockRecorder ¶
type MockICoreMockRecorder struct {
// contains filtered or unexported fields
}
MockICoreMockRecorder is the mock recorder for MockICore
func (*MockICoreMockRecorder) HandleEvent ¶
func (mr *MockICoreMockRecorder) HandleEvent(arg0, arg1 interface{}) *gomock.Call
HandleEvent indicates an expected call of HandleEvent
func (*MockICoreMockRecorder) RegisterEventHandler ¶
func (mr *MockICoreMockRecorder) RegisterEventHandler(arg0, arg1, arg2 interface{}) *gomock.Call
RegisterEventHandler indicates an expected call of RegisterEventHandler
func (*MockICoreMockRecorder) RegisterSchemaEventHandler ¶
func (mr *MockICoreMockRecorder) RegisterSchemaEventHandler(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
RegisterSchemaEventHandler indicates an expected call of RegisterSchemaEventHandler
func (*MockICoreMockRecorder) TriggerEvent ¶
func (mr *MockICoreMockRecorder) TriggerEvent(arg0, arg1 interface{}) *gomock.Call
TriggerEvent indicates an expected call of TriggerEvent
type MockIDatabase ¶
type MockIDatabase struct {
// contains filtered or unexported fields
}
MockIDatabase is a mock of IDatabase interface
func NewMockIDatabase ¶
func NewMockIDatabase(ctrl *gomock.Controller) *MockIDatabase
NewMockIDatabase creates a new mock instance
func (*MockIDatabase) Begin ¶
func (m *MockIDatabase) Begin() (ITransaction, error)
Begin mocks base method
func (*MockIDatabase) BeginTx ¶
func (m *MockIDatabase) BeginTx(arg0 Context, arg1 *TxOptions) (ITransaction, error)
BeginTx mocks base method
func (*MockIDatabase) EXPECT ¶
func (m *MockIDatabase) EXPECT() *MockIDatabaseMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockIDatabase) Options ¶
func (m *MockIDatabase) Options() DbOptions
Options mocks base method
func (*MockIDatabase) Within ¶
func (m *MockIDatabase) Within(arg0 Context, arg1 func(ITransaction) error) error
Within mocks base method
func (*MockIDatabase) WithinTx ¶
func (m *MockIDatabase) WithinTx(arg0 Context, arg1 *TxOptions, arg2 func(ITransaction) error) error
WithinTx mocks base method
type MockIDatabaseMockRecorder ¶
type MockIDatabaseMockRecorder struct {
// contains filtered or unexported fields
}
MockIDatabaseMockRecorder is the mock recorder for MockIDatabase
func (*MockIDatabaseMockRecorder) Begin ¶
func (mr *MockIDatabaseMockRecorder) Begin() *gomock.Call
Begin indicates an expected call of Begin
func (*MockIDatabaseMockRecorder) BeginTx ¶
func (mr *MockIDatabaseMockRecorder) BeginTx(arg0, arg1 interface{}) *gomock.Call
BeginTx indicates an expected call of BeginTx
func (*MockIDatabaseMockRecorder) Options ¶
func (mr *MockIDatabaseMockRecorder) Options() *gomock.Call
Options indicates an expected call of Options
func (*MockIDatabaseMockRecorder) Within ¶
func (mr *MockIDatabaseMockRecorder) Within(arg0, arg1 interface{}) *gomock.Call
Within indicates an expected call of Within
func (*MockIDatabaseMockRecorder) WithinTx ¶
func (mr *MockIDatabaseMockRecorder) WithinTx(arg0, arg1, arg2 interface{}) *gomock.Call
WithinTx indicates an expected call of WithinTx
type MockIEnvironment ¶
type MockIEnvironment interface { IEnvironment SetMockModules(modules MockModules) GetController() *gomock.Controller MockCore() *MockICore MockLogger() *MockILogger MockSchemas() *MockISchemas MockSync() *MockISync MockDatabase() *MockIDatabase MockHttp() *MockIHTTP MockAuth() *MockIAuth MockConfig() *MockIConfig MockUtil() *MockIUtil }
MockIEnvironment is the only scope of Gohan available for a go unit tests extensions; it should not be used outside unit tests
type MockIHTTP ¶
type MockIHTTP struct {
// contains filtered or unexported fields
}
MockIHTTP is a mock of IHTTP interface
func NewMockIHTTP ¶
func NewMockIHTTP(ctrl *gomock.Controller) *MockIHTTP
NewMockIHTTP creates a new mock instance
func (*MockIHTTP) EXPECT ¶
func (m *MockIHTTP) EXPECT() *MockIHTTPMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
type MockIHTTPMockRecorder ¶
type MockIHTTPMockRecorder struct {
// contains filtered or unexported fields
}
MockIHTTPMockRecorder is the mock recorder for MockIHTTP
func (*MockIHTTPMockRecorder) Request ¶
func (mr *MockIHTTPMockRecorder) Request(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call
Request indicates an expected call of Request
func (*MockIHTTPMockRecorder) RequestRaw ¶
func (mr *MockIHTTPMockRecorder) RequestRaw(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call
RequestRaw indicates an expected call of RequestRaw
type MockILogger ¶
type MockILogger struct {
// contains filtered or unexported fields
}
MockILogger is a mock of ILogger interface
func NewMockILogger ¶
func NewMockILogger(ctrl *gomock.Controller) *MockILogger
NewMockILogger creates a new mock instance
func (*MockILogger) Critical ¶
func (m *MockILogger) Critical(arg0 string)
Critical mocks base method
func (*MockILogger) Criticalf ¶
func (m *MockILogger) Criticalf(arg0 string, arg1 ...interface{})
Criticalf mocks base method
func (*MockILogger) Debugf ¶
func (m *MockILogger) Debugf(arg0 string, arg1 ...interface{})
Debugf mocks base method
func (*MockILogger) EXPECT ¶
func (m *MockILogger) EXPECT() *MockILoggerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockILogger) Errorf ¶
func (m *MockILogger) Errorf(arg0 string, arg1 ...interface{})
Errorf mocks base method
func (*MockILogger) Infof ¶
func (m *MockILogger) Infof(arg0 string, arg1 ...interface{})
Infof mocks base method
func (*MockILogger) Noticef ¶
func (m *MockILogger) Noticef(arg0 string, arg1 ...interface{})
Noticef mocks base method
func (*MockILogger) Warningf ¶
func (m *MockILogger) Warningf(arg0 string, arg1 ...interface{})
Warningf mocks base method
type MockILoggerMockRecorder ¶
type MockILoggerMockRecorder struct {
// contains filtered or unexported fields
}
MockILoggerMockRecorder is the mock recorder for MockILogger
func (*MockILoggerMockRecorder) Critical ¶
func (mr *MockILoggerMockRecorder) Critical(arg0 interface{}) *gomock.Call
Critical indicates an expected call of Critical
func (*MockILoggerMockRecorder) Criticalf ¶
func (mr *MockILoggerMockRecorder) Criticalf(arg0 interface{}, arg1 ...interface{}) *gomock.Call
Criticalf indicates an expected call of Criticalf
func (*MockILoggerMockRecorder) Debug ¶
func (mr *MockILoggerMockRecorder) Debug(arg0 interface{}) *gomock.Call
Debug indicates an expected call of Debug
func (*MockILoggerMockRecorder) Debugf ¶
func (mr *MockILoggerMockRecorder) Debugf(arg0 interface{}, arg1 ...interface{}) *gomock.Call
Debugf indicates an expected call of Debugf
func (*MockILoggerMockRecorder) Error ¶
func (mr *MockILoggerMockRecorder) Error(arg0 interface{}) *gomock.Call
Error indicates an expected call of Error
func (*MockILoggerMockRecorder) Errorf ¶
func (mr *MockILoggerMockRecorder) Errorf(arg0 interface{}, arg1 ...interface{}) *gomock.Call
Errorf indicates an expected call of Errorf
func (*MockILoggerMockRecorder) Info ¶
func (mr *MockILoggerMockRecorder) Info(arg0 interface{}) *gomock.Call
Info indicates an expected call of Info
func (*MockILoggerMockRecorder) Infof ¶
func (mr *MockILoggerMockRecorder) Infof(arg0 interface{}, arg1 ...interface{}) *gomock.Call
Infof indicates an expected call of Infof
func (*MockILoggerMockRecorder) Notice ¶
func (mr *MockILoggerMockRecorder) Notice(arg0 interface{}) *gomock.Call
Notice indicates an expected call of Notice
func (*MockILoggerMockRecorder) Noticef ¶
func (mr *MockILoggerMockRecorder) Noticef(arg0 interface{}, arg1 ...interface{}) *gomock.Call
Noticef indicates an expected call of Noticef
func (*MockILoggerMockRecorder) Warning ¶
func (mr *MockILoggerMockRecorder) Warning(arg0 interface{}) *gomock.Call
Warning indicates an expected call of Warning
func (*MockILoggerMockRecorder) Warningf ¶
func (mr *MockILoggerMockRecorder) Warningf(arg0 interface{}, arg1 ...interface{}) *gomock.Call
Warningf indicates an expected call of Warningf
type MockISchemas ¶
type MockISchemas struct {
// contains filtered or unexported fields
}
MockISchemas is a mock of ISchemas interface
func NewMockISchemas ¶
func NewMockISchemas(ctrl *gomock.Controller) *MockISchemas
NewMockISchemas creates a new mock instance
func (*MockISchemas) EXPECT ¶
func (m *MockISchemas) EXPECT() *MockISchemasMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockISchemas) Find ¶
func (m *MockISchemas) Find(arg0 SchemaID) ISchema
Find mocks base method
func (*MockISchemas) Relations ¶
func (m *MockISchemas) Relations(arg0 SchemaID) []SchemaRelationInfo
Relations mocks base method
type MockISchemasMockRecorder ¶
type MockISchemasMockRecorder struct {
// contains filtered or unexported fields
}
MockISchemasMockRecorder is the mock recorder for MockISchemas
func (*MockISchemasMockRecorder) Find ¶
func (mr *MockISchemasMockRecorder) Find(arg0 interface{}) *gomock.Call
Find indicates an expected call of Find
func (*MockISchemasMockRecorder) List ¶
func (mr *MockISchemasMockRecorder) List() *gomock.Call
List indicates an expected call of List
func (*MockISchemasMockRecorder) Relations ¶
func (mr *MockISchemasMockRecorder) Relations(arg0 interface{}) *gomock.Call
Relations indicates an expected call of Relations
type MockISync ¶
type MockISync struct {
// contains filtered or unexported fields
}
MockISync is a mock of ISync interface
func NewMockISync ¶
func NewMockISync(ctrl *gomock.Controller) *MockISync
NewMockISync creates a new mock instance
func (*MockISync) EXPECT ¶
func (m *MockISync) EXPECT() *MockISyncMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
type MockISyncMockRecorder ¶
type MockISyncMockRecorder struct {
// contains filtered or unexported fields
}
MockISyncMockRecorder is the mock recorder for MockISync
func (*MockISyncMockRecorder) Delete ¶
func (mr *MockISyncMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call
Delete indicates an expected call of Delete
func (*MockISyncMockRecorder) Fetch ¶
func (mr *MockISyncMockRecorder) Fetch(arg0 interface{}) *gomock.Call
Fetch indicates an expected call of Fetch
func (*MockISyncMockRecorder) Update ¶
func (mr *MockISyncMockRecorder) Update(arg0, arg1 interface{}) *gomock.Call
Update indicates an expected call of Update
func (*MockISyncMockRecorder) Watch ¶
func (mr *MockISyncMockRecorder) Watch(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
Watch indicates an expected call of Watch
type MockITransaction ¶
type MockITransaction struct {
// contains filtered or unexported fields
}
MockITransaction is a mock of ITransaction interface
func NewMockITransaction ¶
func NewMockITransaction(ctrl *gomock.Controller) *MockITransaction
NewMockITransaction creates a new mock instance
func (*MockITransaction) Commit ¶
func (m *MockITransaction) Commit() error
Commit mocks base method
func (*MockITransaction) Create ¶
func (m *MockITransaction) Create(arg0 context.Context, arg1 ISchema, arg2 map[string]interface{}) error
Create mocks base method
func (*MockITransaction) Delete ¶
func (m *MockITransaction) Delete(arg0 context.Context, arg1 ISchema, arg2 interface{}) error
Delete mocks base method
func (*MockITransaction) EXPECT ¶
func (m *MockITransaction) EXPECT() *MockITransactionMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockITransaction) Exec ¶
func (m *MockITransaction) Exec(arg0 context.Context, arg1 string, arg2 ...interface{}) error
Exec mocks base method
func (*MockITransaction) Fetch ¶
func (m *MockITransaction) Fetch(arg0 context.Context, arg1 ISchema, arg2 Filter) (map[string]interface{}, error)
Fetch mocks base method
func (*MockITransaction) GetIsolationLevel ¶
func (m *MockITransaction) GetIsolationLevel() Type
GetIsolationLevel mocks base method
func (*MockITransaction) List ¶
func (m *MockITransaction) List(arg0 context.Context, arg1 ISchema, arg2 Filter, arg3 *ListOptions, arg4 *Paginator) ([]map[string]interface{}, uint64, error)
List mocks base method
func (*MockITransaction) LockFetch ¶
func (m *MockITransaction) LockFetch(arg0 context.Context, arg1 ISchema, arg2 Filter, arg3 LockPolicy) (map[string]interface{}, error)
LockFetch mocks base method
func (*MockITransaction) LockList ¶
func (m *MockITransaction) LockList(arg0 context.Context, arg1 ISchema, arg2 Filter, arg3 *ListOptions, arg4 *Paginator, arg5 LockPolicy) ([]map[string]interface{}, uint64, error)
LockList mocks base method
func (*MockITransaction) Query ¶
func (m *MockITransaction) Query(arg0 context.Context, arg1 ISchema, arg2 string, arg3 []interface{}) ([]map[string]interface{}, error)
Query mocks base method
func (*MockITransaction) RawTransaction ¶
func (m *MockITransaction) RawTransaction() interface{}
RawTransaction mocks base method
func (*MockITransaction) StateFetch ¶
func (m *MockITransaction) StateFetch(arg0 context.Context, arg1 ISchema, arg2 Filter) (ResourceState, error)
StateFetch mocks base method
func (*MockITransaction) StateUpdate ¶
func (m *MockITransaction) StateUpdate(arg0 context.Context, arg1 ISchema, arg2 map[string]interface{}, arg3 *ResourceState) error
StateUpdate mocks base method
type MockITransactionMockRecorder ¶
type MockITransactionMockRecorder struct {
// contains filtered or unexported fields
}
MockITransactionMockRecorder is the mock recorder for MockITransaction
func (*MockITransactionMockRecorder) Close ¶
func (mr *MockITransactionMockRecorder) Close() *gomock.Call
Close indicates an expected call of Close
func (*MockITransactionMockRecorder) Closed ¶
func (mr *MockITransactionMockRecorder) Closed() *gomock.Call
Closed indicates an expected call of Closed
func (*MockITransactionMockRecorder) Commit ¶
func (mr *MockITransactionMockRecorder) Commit() *gomock.Call
Commit indicates an expected call of Commit
func (*MockITransactionMockRecorder) Count ¶
func (mr *MockITransactionMockRecorder) Count(arg0, arg1, arg2 interface{}) *gomock.Call
Count indicates an expected call of Count
func (*MockITransactionMockRecorder) Create ¶
func (mr *MockITransactionMockRecorder) Create(arg0, arg1, arg2 interface{}) *gomock.Call
Create indicates an expected call of Create
func (*MockITransactionMockRecorder) Delete ¶
func (mr *MockITransactionMockRecorder) Delete(arg0, arg1, arg2 interface{}) *gomock.Call
Delete indicates an expected call of Delete
func (*MockITransactionMockRecorder) Exec ¶
func (mr *MockITransactionMockRecorder) Exec(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call
Exec indicates an expected call of Exec
func (*MockITransactionMockRecorder) Fetch ¶
func (mr *MockITransactionMockRecorder) Fetch(arg0, arg1, arg2 interface{}) *gomock.Call
Fetch indicates an expected call of Fetch
func (*MockITransactionMockRecorder) GetIsolationLevel ¶
func (mr *MockITransactionMockRecorder) GetIsolationLevel() *gomock.Call
GetIsolationLevel indicates an expected call of GetIsolationLevel
func (*MockITransactionMockRecorder) List ¶
func (mr *MockITransactionMockRecorder) List(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call
List indicates an expected call of List
func (*MockITransactionMockRecorder) LockFetch ¶
func (mr *MockITransactionMockRecorder) LockFetch(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
LockFetch indicates an expected call of LockFetch
func (*MockITransactionMockRecorder) LockList ¶
func (mr *MockITransactionMockRecorder) LockList(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call
LockList indicates an expected call of LockList
func (*MockITransactionMockRecorder) Query ¶
func (mr *MockITransactionMockRecorder) Query(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
Query indicates an expected call of Query
func (*MockITransactionMockRecorder) RawTransaction ¶
func (mr *MockITransactionMockRecorder) RawTransaction() *gomock.Call
RawTransaction indicates an expected call of RawTransaction
func (*MockITransactionMockRecorder) StateFetch ¶
func (mr *MockITransactionMockRecorder) StateFetch(arg0, arg1, arg2 interface{}) *gomock.Call
StateFetch indicates an expected call of StateFetch
func (*MockITransactionMockRecorder) StateUpdate ¶
func (mr *MockITransactionMockRecorder) StateUpdate(arg0, arg1, arg2, arg3 interface{}) *gomock.Call
StateUpdate indicates an expected call of StateUpdate
func (*MockITransactionMockRecorder) Update ¶
func (mr *MockITransactionMockRecorder) Update(arg0, arg1, arg2 interface{}) *gomock.Call
Update indicates an expected call of Update
type MockIUtil ¶
type MockIUtil struct {
// contains filtered or unexported fields
}
MockIUtil is a mock of IUtil interface
func NewMockIUtil ¶
func NewMockIUtil(ctrl *gomock.Controller) *MockIUtil
NewMockIUtil creates a new mock instance
func (*MockIUtil) EXPECT ¶
func (m *MockIUtil) EXPECT() *MockIUtilMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockIUtil) GetTransaction ¶
func (m *MockIUtil) GetTransaction(arg0 Context) (ITransaction, bool)
GetTransaction mocks base method
func (*MockIUtil) ResourceFromMapForType ¶
func (m *MockIUtil) ResourceFromMapForType(arg0 map[string]interface{}, arg1 interface{}) (Resource, error)
ResourceFromMapForType mocks base method
func (*MockIUtil) ResourceToMap ¶
ResourceToMap mocks base method
type MockIUtilMockRecorder ¶
type MockIUtilMockRecorder struct {
// contains filtered or unexported fields
}
MockIUtilMockRecorder is the mock recorder for MockIUtil
func (*MockIUtilMockRecorder) GetTransaction ¶
func (mr *MockIUtilMockRecorder) GetTransaction(arg0 interface{}) *gomock.Call
GetTransaction indicates an expected call of GetTransaction
func (*MockIUtilMockRecorder) NewUUID ¶
func (mr *MockIUtilMockRecorder) NewUUID() *gomock.Call
NewUUID indicates an expected call of NewUUID
func (*MockIUtilMockRecorder) ResourceFromMapForType ¶
func (mr *MockIUtilMockRecorder) ResourceFromMapForType(arg0, arg1 interface{}) *gomock.Call
ResourceFromMapForType indicates an expected call of ResourceFromMapForType
func (*MockIUtilMockRecorder) ResourceToMap ¶
func (mr *MockIUtilMockRecorder) ResourceToMap(arg0 interface{}) *gomock.Call
ResourceToMap indicates an expected call of ResourceToMap
type MockModules ¶
type MockModules struct {
Core, Logger, Schemas, Sync, Database, Http, Auth, Util, Config, DefaultDatabase bool
}
MockModules indicates modules which should be mocked. By default none of the modules are mocked so that MockIEnvironment behaves exactly the same as IEnvironment.
type OptionPaginator ¶
type OptionPaginator func(*Paginator)
Below code is adapted from similar code in db/pagination/pagination.go, but doesn't validate parameters.
func OptionKey ¶
func OptionKey(key string) OptionPaginator
func OptionLimit ¶
func OptionLimit(limit uint64) OptionPaginator
func OptionOffset ¶
func OptionOffset(offset uint64) OptionPaginator
func OptionOrder ¶
func OptionOrder(order string) OptionPaginator
type Paginator ¶
Paginator represents a paginator
func NewPaginator ¶
func NewPaginator(options ...OptionPaginator) *Paginator
NewPaginator create Paginator
type ResourceBase ¶
type ResourceBase struct {
// contains filtered or unexported fields
}
ResourceBase is the implementation of base class for all resources
func NewResourceBase ¶
func NewResourceBase(env IEnvironment, schema ISchema, logger ILogger) *ResourceBase
NewResourceBase allocates a new ResourceBase with the given environment, schema and logger
func (*ResourceBase) Environment ¶
func (resourceBase *ResourceBase) Environment() IEnvironment
Environment returns an implementation of IEnvironment interface
func (*ResourceBase) Logger ¶
func (resourceBase *ResourceBase) Logger() ILogger
Logger returns an implementation of ILogger interface
func (*ResourceBase) Schema ¶
func (resourceBase *ResourceBase) Schema() ISchema
Schema returns an implementation of ISchema interface
type ResourceEvent ¶
type ResourceEvent string
const ( PreCreate ResourceEvent = "pre_create" PreCreateTx ResourceEvent = "pre_create_in_transaction" PostCreateTx ResourceEvent = "post_create_in_transaction" PostCreate ResourceEvent = "post_create" PreUpdate ResourceEvent = "pre_update" PreUpdateTx ResourceEvent = "pre_update_in_transaction" PostUpdateTx ResourceEvent = "post_update_in_transaction" PostUpdate ResourceEvent = "post_update" PreShow ResourceEvent = "pre_show" PreShowTx ResourceEvent = "pre_show_in_transaction" PostShowTx ResourceEvent = "post_show_in_transaction" PostShow ResourceEvent = "post_show" PreList ResourceEvent = "pre_list" PreListTx ResourceEvent = "pre_list_in_transaction" PostListTx ResourceEvent = "post_list_in_transaction" PostList ResourceEvent = "post_list" PreDelete ResourceEvent = "pre_delete" PreDeleteTx ResourceEvent = "pre_delete_in_transaction" PostDeleteTx ResourceEvent = "post_delete_in_transaction" PostDelete ResourceEvent = "post_delete" )
Built-in handler types
type ResourceState ¶
type ResourceState struct { ConfigVersion int64 StateVersion int64 Error string State string Monitoring string }
ResourceState represents the state of a resource
type SchemaHandler ¶
type SchemaHandler func(context Context, resource Resource, environment IEnvironment) *Error
SchemaHandler is a schema handler
type SchemaRelationInfo ¶
type SchemaRelationInfo struct { // SchemaID relation to which schema SchemaID SchemaID // PropertyID ID of property which relation is referenced PropertyID string // OnDeleteCascade whether cascading delete on related resource delete is enabled OnDeleteCascade bool }
SchemaRelationInfo describes schema relation
type TxOptions ¶
type TxOptions struct {
IsolationLevel Type
}
TxOptions represents transaction options
type Type ¶
type Type string
Type represents transaction types
const ( //ReadUncommitted is transaction type for READ UNCOMMITTED //You don't need to use this for most case ReadUncommitted Type = "READ UNCOMMITTED" //ReadCommited is transaction type for READ COMMITTED //You don't need to use this for most case ReadCommited Type = "READ COMMITTED" //RepeatableRead is transaction type for REPEATABLE READ //This is default value for read request RepeatableRead Type = "REPEATABLE READ" //Serializable is transaction type for Serializable Serializable Type = "SERIALIZABLE" )