goplugin

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2018 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotPointer indicates that a resource was not passed by a pointer
	ErrNotPointer = errors.New("raw resource must be passed by a pointer")
)

Functions

func Finish

func Finish(testReporter gomock.TestReporter)

func GetSchemaID

func GetSchemaID(schemaID interface{}) goext.SchemaID

func NewController

func NewController(testReporter gomock.TestReporter) *gomock.Controller

func NewSchema

func NewSchema(env IEnvironment, raw *gohan_schema.Schema) goext.ISchema

NewSchema allocates a new Schema

Types

type Auth

type Auth struct{}

Auth is an implementation of IAuth

func (*Auth) GetTenantName

func (a *Auth) GetTenantName(context goext.Context) string

func (*Auth) HasRole

func (a *Auth) HasRole(context goext.Context, principal string) bool

func (*Auth) IsAdmin

func (a *Auth) IsAdmin(context goext.Context) bool

IsAdmin returns true if user had admin role

type Config

type Config struct{}

Config is an implementation of IConfig

func (*Config) Config

func (config *Config) Config(key string, defaultValue interface{}) interface{}

Config gets a parameter from config

type Core

type Core struct {
	// contains filtered or unexported fields
}

Core is an implementation of ICore interface

func NewCore

func NewCore(env *Environment) *Core

NewCore allocates Core

func (*Core) Clone

func (core *Core) Clone(env *Environment) *Core

Clone allocates a clone of Core; object may be nil

func (*Core) HandleEvent

func (core *Core) HandleEvent(event string, context goext.Context) error

HandleEvent Causes the given event to be handled within the same environment

func (*Core) RegisterEventHandler

func (core *Core) RegisterEventHandler(eventName string, handler goext.Handler, priority int)

RegisterEventHandler registers a global handler

func (*Core) RegisterSchemaEventHandler

func (core *Core) RegisterSchemaEventHandler(schemaID goext.SchemaID, eventName string, schemaHandler goext.SchemaHandler, priority int)

RegisterSchemaEventHandler registers a schema handler

func (*Core) TriggerEvent

func (core *Core) TriggerEvent(event string, context goext.Context) error

TriggerEvent causes the given event to be handled in all environments (across different-language extensions)

type Database

type Database struct {
	// contains filtered or unexported fields
}

Database in an implementation of IDatabase

func NewDatabase

func NewDatabase(db gohan_db.DB) *Database

NewDatabase creates new database implementation

func (*Database) Begin

func (db *Database) Begin() (goext.ITransaction, error)

Begin starts a new transaction

func (*Database) BeginTx

func (db *Database) BeginTx(ctx goext.Context, options *goext.TxOptions) (goext.ITransaction, error)

BeginTx starts a new transaction with options

func (*Database) Clone

func (db *Database) Clone() *Database

Clone allocates a clone of Database; object may be nil

func (*Database) Options

func (db *Database) Options() goext.DbOptions

Options return database options from the configuration file

func (*Database) Within

func (db *Database) Within(
	context goext.Context,
	fn func(tx goext.ITransaction) error,
) error

Within calls a function in a scoped transaction

func (*Database) WithinTx

func (db *Database) WithinTx(
	context goext.Context,
	options *goext.TxOptions,
	fn func(tx goext.ITransaction) error,
) error

WithinTx calls a function in a scoped transaction with options

type Environment

type Environment struct {
	// contains filtered or unexported fields
}

Environment golang based environment for gohan extensions

func NewEnvironment

func NewEnvironment(name string, beforeStartHook func(env *Environment) error, afterStopHook func(env *Environment)) *Environment

NewEnvironment create new gohan extension rawEnvironment based on context

func (*Environment) Auth

func (env *Environment) Auth() goext.IAuth

Auth returns an implementation of IAuth interface

func (*Environment) Clone

func (env *Environment) Clone() extension.Environment

Clone makes a clone of the rawEnvironment

func (*Environment) Config

func (env *Environment) Config() goext.IConfig

Config returns an implementation of IConfig interface

func (*Environment) Core

func (env *Environment) Core() goext.ICore

Core returns an implementation of ICore interface

func (*Environment) Database

func (env *Environment) Database() goext.IDatabase

Database returns an implementation of IDatabase interface

func (*Environment) HTTP

func (env *Environment) HTTP() goext.IHTTP

HTTP returns an implementation of IHTTP interface

func (*Environment) HandleEvent

func (env *Environment) HandleEvent(event string, context map[string]interface{}) error

HandleEvent handles an event

func (*Environment) Handlers

func (env *Environment) Handlers() EventPrioritizedHandlers

Handlers returns a copy of handlers - used for testing

func (*Environment) IsEventHandled

func (env *Environment) IsEventHandled(event string, context map[string]interface{}) bool

IsEventHandled returns whether a given event is handled by this environment

func (*Environment) Load

func (env *Environment) Load(fileName string) error

Load loads script into the environment

func (*Environment) LoadExtensionsForPath

func (env *Environment) LoadExtensionsForPath(extensions []*schema.Extension, timeLimit time.Duration, timeLimits []*schema.PathEventTimeLimit, path string) error

LoadExtensionsForPath for returns extensions for specific path

func (*Environment) Logger

func (env *Environment) Logger() goext.ILogger

Logger returns an implementation of ILogger interface

func (*Environment) RawTypes

func (env *Environment) RawTypes() map[goext.SchemaID]reflect.Type

RawTypes returns raw types

func (*Environment) RegisterEventHandler

func (env *Environment) RegisterEventHandler(event string, handler goext.Handler, priority int)

RegisterEventHandler registers an event handler

func (*Environment) RegisterRawType

func (env *Environment) RegisterRawType(name goext.SchemaID, typeValue interface{})

RegisterRawType registers a runtime type of raw resource for a given name

func (*Environment) RegisterSchemaEventHandler

func (env *Environment) RegisterSchemaEventHandler(schemaID goext.SchemaID, event string, schemaHandler goext.SchemaHandler, priority int)

RegisterSchemaEventHandler register an event handler for a schema

func (*Environment) RegisterType

func (env *Environment) RegisterType(name goext.SchemaID, typeValue interface{})

RegisterType registers a runtime type of resource for a given name

func (*Environment) Reset

func (env *Environment) Reset()

Reset clear the environment to its initial state

func (*Environment) SchemaHandlers

func (env *Environment) SchemaHandlers() EventSchemaPrioritizedSchemaHandlers

SchemaHandlers returns a copy of handlers - used for testing

func (*Environment) Schemas

func (env *Environment) Schemas() goext.ISchemas

Schemas returns an implementation of ISchemas interface

func (*Environment) SetDatabase

func (env *Environment) SetDatabase(db gohan_db.DB)

SetDatabase sets and binds database implementation

func (*Environment) SetSync

func (env *Environment) SetSync(sync gohan_sync.Sync)

SetSync sets and binds sync implementation

func (*Environment) Start

func (env *Environment) Start() error

Start starts already loaded environment

func (*Environment) Stop

func (env *Environment) Stop()

Stop stops the environment to its initial state

func (*Environment) Sync

func (env *Environment) Sync() goext.ISync

Sync returns an implementation of ISync interface

func (*Environment) Types

func (env *Environment) Types() map[goext.SchemaID]reflect.Type

Types returns types

func (*Environment) Util

func (env *Environment) Util() goext.IUtil

type EventPrioritizedHandlers

type EventPrioritizedHandlers map[string]PrioritizedHandlers

EventPrioritizedHandlers is a per-event prioritized list of generic handlers

type EventSchemaPrioritizedSchemaHandlers

type EventSchemaPrioritizedSchemaHandlers map[string]SchemaPrioritizedSchemaHandlers

EventSchemaPrioritizedSchemaHandlers is a per-event per-schema prioritized list of schema handlers

type HTTP

type HTTP struct{}

HTTP is an implementation of IHTTP

func (*HTTP) Request

func (http *HTTP) Request(ctx context.Context, method, rawURL string, headers map[string]interface{}, postData interface{}, opaque bool) (*goext.Response, error)

Request performs http request

func (*HTTP) RequestRaw

func (http *HTTP) RequestRaw(ctx context.Context, method, rawURL string, headers map[string]string, rawData string) (*goext.Response, error)

RequestRaw performs raw http request

type Handlers

type Handlers []goext.Handler

Handlers is a list of generic handlers

type IEnvironment

type IEnvironment interface {
	goext.IEnvironment
	extension.Environment

	RegisterSchemaEventHandler(schemaID goext.SchemaID, event string, schemaHandler goext.SchemaHandler, priority int)
	RegisterRawType(name goext.SchemaID, typeValue interface{})
	RegisterType(name goext.SchemaID, typeValue interface{})
	// contains filtered or unexported methods
}

Internal interface for goplugin environment

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger is an implementation of ILogger

func NewLogger

func NewLogger(env IEnvironment) *Logger

NewLogger allocates Logger

func (*Logger) Clone

func (logger *Logger) Clone(env *Environment) *Logger

Clone allocates a clone of Logger; object may be nil

func (*Logger) Critical

func (logger *Logger) Critical(format string)

Critical emits a critical log message

func (*Logger) Criticalf

func (logger *Logger) Criticalf(format string, args ...interface{})

Criticalf emits a formatted critical log message

func (*Logger) Debug

func (logger *Logger) Debug(format string)

Debug emits a debug log message

func (*Logger) Debugf

func (logger *Logger) Debugf(format string, args ...interface{})

Debugf emits a formatted debug log message

func (*Logger) Error

func (logger *Logger) Error(format string)

Error emits an error log message

func (*Logger) Errorf

func (logger *Logger) Errorf(format string, args ...interface{})

Errorf emits a formatted error log message

func (*Logger) Info

func (logger *Logger) Info(format string)

Info emits an info log message

func (*Logger) Infof

func (logger *Logger) Infof(format string, args ...interface{})

Infof emits a formatted info log message

func (*Logger) Notice

func (logger *Logger) Notice(format string)

Notice emits a notice log message

func (*Logger) Noticef

func (logger *Logger) Noticef(format string, args ...interface{})

Noticef emits a formatted notice log message

func (*Logger) Warning

func (logger *Logger) Warning(format string)

Warning emits a warning log message

func (*Logger) Warningf

func (logger *Logger) Warningf(format string, args ...interface{})

Warningf emits a formatted warning log message

type MockIEnvironment

type MockIEnvironment struct {
	// contains filtered or unexported fields
}

func NewMockIEnvironment

func NewMockIEnvironment(env *Environment, testReporter gomock.TestReporter) *MockIEnvironment

func (*MockIEnvironment) Auth

func (mockEnv *MockIEnvironment) Auth() goext.IAuth

func (*MockIEnvironment) Clone

func (mockEnv *MockIEnvironment) Clone() extension.Environment

func (*MockIEnvironment) Config

func (mockEnv *MockIEnvironment) Config() goext.IConfig

func (*MockIEnvironment) Core

func (mockEnv *MockIEnvironment) Core() goext.ICore

func (*MockIEnvironment) Database

func (mockEnv *MockIEnvironment) Database() goext.IDatabase

func (*MockIEnvironment) GetController

func (mockEnv *MockIEnvironment) GetController() *gomock.Controller

func (*MockIEnvironment) HTTP

func (mockEnv *MockIEnvironment) HTTP() goext.IHTTP

func (*MockIEnvironment) HandleEvent

func (mockEnv *MockIEnvironment) HandleEvent(event string, context map[string]interface{}) error

func (*MockIEnvironment) IsEventHandled

func (mockEnv *MockIEnvironment) IsEventHandled(event string, context map[string]interface{}) bool

func (*MockIEnvironment) LoadExtensionsForPath

func (mockEnv *MockIEnvironment) LoadExtensionsForPath(extensions []*schema.Extension, timeLimit time.Duration, timeLimits []*schema.PathEventTimeLimit, path string) error

func (*MockIEnvironment) Logger

func (mockEnv *MockIEnvironment) Logger() goext.ILogger

func (*MockIEnvironment) MockAuth

func (mockEnv *MockIEnvironment) MockAuth() *goext.MockIAuth

func (*MockIEnvironment) MockConfig

func (mockEnv *MockIEnvironment) MockConfig() *goext.MockIConfig

func (*MockIEnvironment) MockCore

func (mockEnv *MockIEnvironment) MockCore() *goext.MockICore

func (*MockIEnvironment) MockDatabase

func (mockEnv *MockIEnvironment) MockDatabase() *goext.MockIDatabase

func (*MockIEnvironment) MockHttp

func (mockEnv *MockIEnvironment) MockHttp() *goext.MockIHTTP

func (*MockIEnvironment) MockLogger

func (mockEnv *MockIEnvironment) MockLogger() *goext.MockILogger

func (*MockIEnvironment) MockSchemas

func (mockEnv *MockIEnvironment) MockSchemas() *goext.MockISchemas

func (*MockIEnvironment) MockSync

func (mockEnv *MockIEnvironment) MockSync() *goext.MockISync

func (*MockIEnvironment) MockUtil

func (mockEnv *MockIEnvironment) MockUtil() *goext.MockIUtil

func (*MockIEnvironment) RegisterRawType

func (mockEnv *MockIEnvironment) RegisterRawType(name goext.SchemaID, typeValue interface{})

func (*MockIEnvironment) RegisterSchemaEventHandler

func (mockEnv *MockIEnvironment) RegisterSchemaEventHandler(schemaID goext.SchemaID, event string, schemaHandler goext.SchemaHandler, priority int)

func (*MockIEnvironment) RegisterType

func (mockEnv *MockIEnvironment) RegisterType(name goext.SchemaID, typeValue interface{})

func (*MockIEnvironment) Reset

func (mockEnv *MockIEnvironment) Reset()

func (*MockIEnvironment) Schemas

func (mockEnv *MockIEnvironment) Schemas() goext.ISchemas

func (*MockIEnvironment) SetMockModules

func (mockEnv *MockIEnvironment) SetMockModules(modules goext.MockModules)

func (*MockIEnvironment) Sync

func (mockEnv *MockIEnvironment) Sync() goext.ISync

func (*MockIEnvironment) Util

func (mockEnv *MockIEnvironment) Util() goext.IUtil

type PrioritizedHandlers

type PrioritizedHandlers map[int]Handlers

PrioritizedHandlers is a prioritized list of generic handlers

type PrioritizedSchemaHandlers

type PrioritizedSchemaHandlers map[int]SchemaHandlers

PrioritizedSchemaHandlers is a prioritized list of schema handlers

type Schema

type Schema struct {
	// contains filtered or unexported fields
}

Schema is an implementation of ISchema

func (*Schema) ColumnNames

func (schema *Schema) ColumnNames() []string

ColumnNames generates an array that has Gohan style column names

func (*Schema) Count

func (schema *Schema) Count(filter goext.Filter, requestContext goext.Context) (uint64, error)

Count returns number of resources matching the filter

func (*Schema) CreateRaw

func (schema *Schema) CreateRaw(rawResource interface{}, context goext.Context) error

CreateRaw creates a resource

func (*Schema) DbCreateRaw

func (schema *Schema) DbCreateRaw(rawResource interface{}, context goext.Context) error

DbCreateRaw creates a resource without triggering events

func (*Schema) DbDeleteFilterRaw

func (schema *Schema) DbDeleteFilterRaw(filter goext.Filter, context goext.Context) error

DbDeleteFilterRaw deletes resource by filter without triggering events

func (*Schema) DbDeleteRaw

func (schema *Schema) DbDeleteRaw(id string, context goext.Context) error

DbDeleteRaw deletes resource by ID without triggering events

func (*Schema) DbStateUpdateRaw

func (schema *Schema) DbStateUpdateRaw(rawResource interface{}, requestContext goext.Context, state *goext.ResourceState) error

DbStateUpdateRaw updates states of a raw resource

func (*Schema) DbUpdateRaw

func (schema *Schema) DbUpdateRaw(rawResource interface{}, context goext.Context) error

DbUpdateRaw updates a raw resource without triggering events

func (*Schema) DeleteFilterRaw

func (schema *Schema) DeleteFilterRaw(filter goext.Filter, context goext.Context) error

DeleteFilterRaw deletes resource by filter

func (*Schema) DeleteRaw

func (schema *Schema) DeleteRaw(id string, context goext.Context) error

DeleteRaw deletes resource by ID

func (*Schema) DerivedSchemas

func (schema *Schema) DerivedSchemas() []goext.ISchema

DerivedSchemas returns list of schemas that extend schema with given id

func (*Schema) Extends

func (schema *Schema) Extends() []goext.SchemaID

Extends returns schema_ids which given schema extends

func (*Schema) Fetch

func (schema *Schema) Fetch(id string, context goext.Context) (interface{}, error)

Fetch fetches a resource by ID. Schema, Logger, Environment and pointer to raw resource are required fields in the resource

func (*Schema) FetchFilter

func (schema *Schema) FetchFilter(filter goext.Filter, context goext.Context) (interface{}, error)

FetchFilter returns a pointer to resource derived from BaseResource Schema, Logger, Environment and pointer to raw resource are required fields in the resource

func (*Schema) FetchFilterRaw

func (schema *Schema) FetchFilterRaw(filter goext.Filter, context goext.Context) (interface{}, error)

FetchFilterRaw returns a pointer to raw resource, containing db annotations

func (*Schema) FetchRaw

func (schema *Schema) FetchRaw(id string, context goext.Context) (interface{}, error)

FetchRaw fetches a raw resource by ID

func (*Schema) ID

func (schema *Schema) ID() goext.SchemaID

ID returns ID of schema

func (*Schema) List

func (schema *Schema) List(filter goext.Filter, paginator *goext.Paginator, context goext.Context) ([]interface{}, error)

List returns list of resources. Schema, Logger, Environment and pointer to raw resource are required fields in the resource

func (*Schema) ListRaw

func (schema *Schema) ListRaw(filter goext.Filter, paginator *goext.Paginator, requestContext goext.Context) ([]interface{}, error)

ListRaw lists schema raw resources

func (*Schema) LockFetch

func (schema *Schema) LockFetch(id string, context goext.Context, policy goext.LockPolicy) (interface{}, error)

LockFetch fetches a resource by ID. Schema, Logger, Environment and pointer to raw resource are required fields in the resource

func (*Schema) LockFetchFilter

func (schema *Schema) LockFetchFilter(filter goext.Filter, context goext.Context, policy goext.LockPolicy) (interface{}, error)

LockFetchFilter returns a pointer to locked resource derived from BaseResource, containing db annotations Schema, Logger, Environment and pointer to raw resource are required fields in the resource

func (*Schema) LockFetchFilterRaw

func (schema *Schema) LockFetchFilterRaw(filter goext.Filter, context goext.Context, policy goext.LockPolicy) (interface{}, error)

LockFetchFilterRaw returns a pointer to locked raw resource, containing db annotations

func (*Schema) LockFetchRaw

func (schema *Schema) LockFetchRaw(id string, context goext.Context, policy goext.LockPolicy) (interface{}, error)

LockFetchRaw locks and fetches resource by ID

func (*Schema) LockList

func (schema *Schema) LockList(filter goext.Filter, paginator *goext.Paginator, context goext.Context, policy goext.LockPolicy) ([]interface{}, error)

LockList locks and returns list of resources. Schema, Logger, Environment and pointer to raw resource are required fields in the resource

func (*Schema) LockListRaw

func (schema *Schema) LockListRaw(filter goext.Filter, paginator *goext.Paginator, requestContext goext.Context, policy goext.LockPolicy) ([]interface{}, error)

LockListRaw locks and returns raw resources

func (*Schema) Properties

func (schema *Schema) Properties() []goext.Property

Properties returns properties of schema

func (*Schema) RawSchema

func (schema *Schema) RawSchema() interface{}

func (*Schema) RegisterCustomEventHandler

func (schema *Schema) RegisterCustomEventHandler(event goext.CustomEvent, handler goext.Handler, priority int)

RegisterCustomEventHandler registers an event handler without resource for a custom event with given priority

func (*Schema) RegisterRawType

func (schema *Schema) RegisterRawType(typeValue interface{})

RegisterRawType registers a runtime type for a raw resource

func (*Schema) RegisterResourceEventHandler

func (schema *Schema) RegisterResourceEventHandler(event goext.ResourceEvent, schemaHandler goext.SchemaHandler, priority int)

RegisterResourceEventHandler registers a schema handler

func (*Schema) RegisterType

func (schema *Schema) RegisterType(resourceType goext.IResourceBase)

RegisterType registers a runtime type for a resource

func (*Schema) RegisterTypes

func (schema *Schema) RegisterTypes(rawResourceType interface{}, resourceType goext.IResourceBase)

RegisterTypes registers both resource types derived from IResourceBase and raw containing db annotations

func (*Schema) ResourceFromMap

func (schema *Schema) ResourceFromMap(context map[string]interface{}) (goext.Resource, error)

ResourceFromMap converts mapped representation to structure representation of the resource registered for schema

func (*Schema) StateFetchRaw

func (schema *Schema) StateFetchRaw(id string, requestContext goext.Context) (goext.ResourceState, error)

StateFetchRaw returns a resource state

func (*Schema) UpdateRaw

func (schema *Schema) UpdateRaw(rawResource interface{}, context goext.Context) error

UpdateRaw updates a resource and triggers handlers

type SchemaHandlers

type SchemaHandlers []goext.SchemaHandler

SchemaHandlers is a list of schema handlers

type SchemaPrioritizedSchemaHandlers

type SchemaPrioritizedSchemaHandlers map[goext.SchemaID]PrioritizedSchemaHandlers

SchemaPrioritizedSchemaHandlers is a per-schema prioritized list of schema handlers

type Schemas

type Schemas struct {
	// contains filtered or unexported fields
}

Schemas in an implementation of ISchemas

func NewSchemas

func NewSchemas(env IEnvironment) *Schemas

NewSchemas allocates a new Schemas

func (*Schemas) Clone

func (schemas *Schemas) Clone(env *Environment) *Schemas

Clone allocates a clone of Schemas; object may be nil

func (*Schemas) Find

func (schemas *Schemas) Find(id goext.SchemaID) goext.ISchema

Find returns a schema by id or nil if not found

func (*Schemas) List

func (schemas *Schemas) List() []goext.ISchema

List returns a list of loaded schemas

func (*Schemas) Relations

func (schemas *Schemas) Relations(id goext.SchemaID) []goext.SchemaRelationInfo

type Sync

type Sync struct {
	// contains filtered or unexported fields
}

Sync is an implementation of ISync

func NewSync

func NewSync(sync gohan_sync.Sync) *Sync

NewSync allocates Sync

func (*Sync) Clone

func (sync *Sync) Clone() *Sync

Clone allocates a clone of Sync; object may be nil

func (*Sync) Delete

func (sync *Sync) Delete(path string, prefix bool) error

Delete deletes a path from sync

func (*Sync) Fetch

func (sync *Sync) Fetch(path string) (*goext.Node, error)

Fetch fetches a path from sync

func (*Sync) Update

func (sync *Sync) Update(path string, json string) error

Update updates a path with given json

func (*Sync) Watch

func (sync *Sync) Watch(ctx context.Context, path string, timeout time.Duration, revision int64) ([]*goext.Event, error)

Watch watches a single path in sync

type Transaction

type Transaction struct {
	// contains filtered or unexported fields
}

Transaction is common interface for handling transaction

func (*Transaction) Close

func (t *Transaction) Close() error

Close closes the transaction

func (*Transaction) Closed

func (t *Transaction) Closed() bool

Closed return whether the transaction is closed

func (*Transaction) Commit

func (t *Transaction) Commit() error

Commit performs a commit of the transaction

func (*Transaction) Count

func (t *Transaction) Count(ctx context.Context, schema goext.ISchema, filter goext.Filter) (uint64, error)

func (*Transaction) Create

func (t *Transaction) Create(ctx context.Context, s goext.ISchema, resource map[string]interface{}) error

Create creates a new resource

func (*Transaction) Delete

func (t *Transaction) Delete(ctx context.Context, schema goext.ISchema, resourceID interface{}) error

Delete deletes an existing resource

func (*Transaction) Exec

func (t *Transaction) Exec(ctx context.Context, query string, args ...interface{}) error

Exec performs an exec in transaction

func (*Transaction) Fetch

func (t *Transaction) Fetch(ctx context.Context, schema goext.ISchema, filter goext.Filter) (map[string]interface{}, error)

Fetch fetches an existing resource

func (*Transaction) GetIsolationLevel

func (t *Transaction) GetIsolationLevel() goext.Type

GetIsolationLevel returns the isolation level of the transaction

func (*Transaction) List

func (t *Transaction) List(ctx context.Context, schema goext.ISchema, filter goext.Filter, listOptions *goext.ListOptions, paginator *goext.Paginator) ([]map[string]interface{}, uint64, error)

List lists existing resources

func (*Transaction) LockFetch

func (t *Transaction) LockFetch(ctx context.Context, schema goext.ISchema, filter goext.Filter, lockPolicy goext.LockPolicy) (map[string]interface{}, error)

LockFetch locks and fetches an existing resource

func (*Transaction) LockList

func (t *Transaction) LockList(ctx context.Context, schema goext.ISchema, filter goext.Filter, listOptions *goext.ListOptions, paginator *goext.Paginator, lockingPolicy goext.LockPolicy) ([]map[string]interface{}, uint64, error)

LockList locks and lists existing resources

func (*Transaction) Query

func (t *Transaction) Query(ctx context.Context, schema goext.ISchema, query string, args []interface{}) (list []map[string]interface{}, err error)

Query executes a query

func (*Transaction) RawTransaction

func (t *Transaction) RawTransaction() interface{}

RawTransaction returns the raw transaction

func (*Transaction) StateFetch

func (t *Transaction) StateFetch(ctx context.Context, schema goext.ISchema, filter goext.Filter) (goext.ResourceState, error)

StateFetch fetches the state of an existing resource

func (*Transaction) StateUpdate

func (t *Transaction) StateUpdate(ctx context.Context, s goext.ISchema, resource map[string]interface{}, resourceState *goext.ResourceState) error

StateUpdate updates state of an existing resource

func (*Transaction) Update

func (t *Transaction) Update(ctx context.Context, s goext.ISchema, resource map[string]interface{}) error

Update updates an existing resource

type Util

type Util struct {
}

func (*Util) Clone

func (util *Util) Clone() *Util

func (*Util) GetTransaction

func (util *Util) GetTransaction(context goext.Context) (goext.ITransaction, bool)

func (*Util) NewUUID

func (util *Util) NewUUID() string

NewUUID create a new unique ID

func (*Util) ResourceFromMapForType

func (util *Util) ResourceFromMapForType(context map[string]interface{}, rawResource interface{}) (goext.Resource, error)

ResourceFromMapForType converts mapped representation to structure representation of the resource for given type

func (*Util) ResourceToMap

func (util *Util) ResourceToMap(resource interface{}) map[string]interface{}

ResourceToMap converts structure representation of the resource to mapped representation

Directories

Path Synopsis
test_data

Jump to

Keyboard shortcuts

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