Documentation ¶
Index ¶
- Constants
- Variables
- func AsViewParam(aView *View, aSelector *Statelet, batchData *BatchData, options ...interface{}) *expand.ViewContext
- func BuildPresenceType(parameters []*state.Parameter) (reflect.Type, error)
- func BuildTree(schemaType reflect.Type, slice *xunsafe.Slice, nodes interface{}, ...) interface{}
- func ColumnsSchema(caseFormat text.CaseFormat, columns []*Column, relations []*Relation, v *View) func() (reflect.Type, error)
- func ColumnsSchemaDocumented(caseFormat text.CaseFormat, columns []*Column, relations []*Relation, v *View, ...) func() (reflect.Type, error)
- func DefaultTypeName(name string) string
- func Description(paramName, viewName string) string
- func Evaluate(evaluator *expand.Evaluator, options ...expand.StateOption) (*expand.State, error)
- func ExpandWithFalseCondition(source string) string
- func NewEvaluator(parameters state.Parameters, stateType *structology.StateType, template string, ...) (*expand.Evaluator, error)
- func NewMapBasedDoc(types *TypesDoc) docs.Service
- func NewMockSanitizer() *expand.DataUnit
- func ParamType(name string) reflect.Type
- func ResetAerospikePool()
- func ResetConnectionConfig()
- func ResetDBPool()
- func SummaryViewKey(ownerName, name string) string
- type AerospikeConfig
- type Batch
- type BatchData
- type Cache
- type CacheInput
- type CacheInputFn
- type CacheParameters
- type Caches
- type Collector
- func (r *Collector) AddMeta(row interface{}) error
- func (r *Collector) Clone() *Collector
- func (r *Collector) Dest() interface{}
- func (r *Collector) DestPtr() interface{}
- func (r *Collector) Fetched()
- func (r *Collector) Len() int
- func (r *Collector) Lock() *sync.Mutex
- func (r *Collector) MergeData()
- func (r *Collector) NewItem() func() interface{}
- func (r *Collector) OnSkip(_ []interface{}) error
- func (r *Collector) ParentPlaceholders() ([]interface{}, []string)
- func (r *Collector) ReadAll() bool
- func (r *Collector) Relation() *Relation
- func (r *Collector) Relations(selector *Statelet) ([]*Collector, error)
- func (r *Collector) Resolve(column io.Column) func(ptr unsafe.Pointer) interface{}
- func (r *Collector) SetDest(dest interface{})
- func (r *Collector) Slice() (unsafe.Pointer, *xunsafe.Slice)
- func (r *Collector) View() *View
- func (r *Collector) ViewMetaHandler(rel *Relation) (func(viewMeta interface{}) error, error)
- func (r *Collector) Visitor(ctx context.Context) VisitorFn
- func (r *Collector) WaitIfNeeded()
- type Column
- func (c *Column) ApplyConfig(config *ColumnConfig)
- func (c *Column) CaseFormat() text.CaseFormat
- func (c *Column) ColumnName() string
- func (c *Column) ColumnType() reflect.Type
- func (c *Column) EnsureFormatTag()
- func (c *Column) EnsureType(lookupType xreflect.LookupType) error
- func (c *Column) Field() *reflect.StructField
- func (c *Column) FieldName() string
- func (c *Column) Init(resource state.Resource, caseFormat text.CaseFormat, allowNulls bool) error
- func (c *Column) SetColumnType(rType reflect.Type)
- func (c *Column) SetField(field reflect.StructField)
- func (c *Column) SqlExpression() string
- func (c *Column) TimeLayout() string
- type ColumnConfig
- type ColumnConfigs
- type ColumnOption
- type Columns
- type Config
- func (c *Config) Clone() *Config
- func (c *Config) CloneWithNs(ctx context.Context, resource *Resource, owner *View, ns string) (*Config, error)
- func (c *Config) GetContentFormatParameter() *state.Parameter
- func (c *Config) GetSyncFlagParameter() *state.Parameter
- func (c *Config) Init(ctx context.Context, resource *Resource, parent *View) error
- type Connector
- type ConnectorOption
- type ConnectorSlice
- type Connectors
- type Constraints
- type CriteriaParam
- type DBConfig
- type Docs
- type EncodedConnector
- type ExpanderFn
- type Field
- type Link
- type Links
- type MapBasedDoc
- type MatchStrategy
- type MessageBusSlice
- type MessageBuses
- type MetaKind
- type Method
- type Metrics
- type Mode
- type NamedColumnConfig
- type NamedColumns
- func (c NamedColumns) Column(name string) (codec.Column, bool)
- func (c NamedColumns) ColumnName(key string) (string, error)
- func (c NamedColumns) Lookup(name string) (*Column, error)
- func (c NamedColumns) Register(caseFormat text.CaseFormat, column *Column)
- func (c NamedColumns) RegisterHolder(columnName, holder string) error
- func (c NamedColumns) RegisterWithName(name string, column *Column)
- type NamedResources
- type NamedViews
- type Names
- type NamespaceView
- type NamespacedView
- type NodeIndex
- type Option
- func WithBatchSize(size int) Option
- func WithColumns(columns Columns) Option
- func WithConnector(connector *Connector) Option
- func WithConnectorRef(ref string) Option
- func WithCriteria(columns ...string) Option
- func WithDBConfig(dbConfig *DBConfig) Option
- func WithFS(fs *embed.FS) Option
- func WithLimit(limit *int) Option
- func WithMatchStrategy(match string) Option
- func WithMode(mode Mode) Option
- func WithOneToMany(holder string, on Links, ref *ReferenceView, opts ...RelationOption) Option
- func WithOneToOne(holder string, on Links, ref *ReferenceView, opts ...RelationOption) Option
- func WithPartitioned(partitioned *Partitioned) Option
- func WithReinitialize() Option
- func WithResource(resource state.Resource) Option
- func WithSQL(SQL string, parameters ...*state.Parameter) Option
- func WithSchema(schema *state.Schema) Option
- func WithStructTag(tag reflect.StructTag, fs *embed.FS) Option
- func WithTag(aTag *tags.Tag) Option
- func WithTemplate(template *Template) Option
- func WithTransforms(transforms marshal.Transforms) Option
- func WithViewKind(mode Mode) Option
- func WithViewType(t reflect.Type, options ...state.SchemaOption) Option
- type Options
- type PackagedType
- type ParamValue
- type Partitioned
- type Partitioner
- type Partitions
- type PredicateEvaluator
- type QuerySelector
- func (s *QuerySelector) Add(fieldName string, isHolder bool)
- func (s *QuerySelector) CurrentLimit() int
- func (s *QuerySelector) CurrentOffset() int
- func (s *QuerySelector) CurrentPage() int
- func (s *QuerySelector) Has(field string) bool
- func (s *QuerySelector) SetCriteria(expanded string, placeholders []interface{})
- type QuerySettings
- type Reducer
- type ReducerProvider
- type ReferenceView
- type Relation
- type RelationOption
- type RelationsSlice
- type Resource
- func (r *Resource) AddConnector(name string, driver string, dsn string, opts ...ConnectorOption) *Connector
- func (r *Resource) AddConnectors(connectors ...*Connector)
- func (r *Resource) AddLoggers(loggers ...*logger.Adapter)
- func (r *Resource) AddMessageBus(messageBuses ...*mbus.Resource)
- func (r *Resource) AddParameters(parameters ...*state.Parameter)
- func (r *Resource) AddViews(views ...*View)
- func (r *Resource) CacheProvider(ref string) (*Cache, bool)
- func (r *Resource) CodecByName(name string) (*codec.Codec, bool)
- func (r *Resource) Connector(name string) (*Connector, error)
- func (r *Resource) ConnectorByName() Connectors
- func (r *Resource) Doc() (docs.Service, bool)
- func (r *Resource) ExistsConnector(name string) bool
- func (r *Resource) FindConnector(view *View) (*Connector, error)
- func (r *Resource) GetConnectors() Connectors
- func (r *Resource) GetViews() NamedViews
- func (r *Resource) IndexViews()
- func (r *Resource) Init(ctx context.Context, options ...interface{}) error
- func (r *Resource) LoadObject(ctx context.Context, URL string) (storage.Object, error)
- func (r *Resource) LoadText(ctx context.Context, URL string) (string, error)
- func (r *Resource) LookupParameter(name string) (*state.Parameter, error)
- func (r *Resource) LookupType() xreflect.LookupType
- func (r *Resource) MergeFrom(resource *Resource, types *xreflect.Types)
- func (r *Resource) MessageBus(name string) (*mbus.Resource, error)
- func (r *Resource) NamedParameters() state.NamedParameters
- func (r *Resource) ParamByName(name string) (*state.Parameter, error)
- func (r *Resource) SetCodecs(codecs *codec.Registry)
- func (r *Resource) SetFs(fs afs.Service)
- func (r *Resource) SetTypes(types *xreflect.Types)
- func (r *Resource) TypeName(t reflect.Type) (string, bool)
- func (r *Resource) TypeRegistry() *xreflect.Types
- func (r *Resource) View(name string) (*View, error)
- func (r *Resource) ViewSchema(ctx context.Context, name string) (*state.Schema, error)
- type ResourceOptions
- type Resourcelet
- func (r *Resourcelet) AppendParameter(parameter *state.Parameter)
- func (r *Resourcelet) CodecOptions() *codec.Options
- func (r *Resourcelet) Codecs() *codec.Registry
- func (r *Resourcelet) ExpandSubstitutes(text string) string
- func (r Resourcelet) IndexedColumns() NamedColumns
- func (r *Resourcelet) LookupParameter(name string) (*state.Parameter, error)
- func (r *Resourcelet) ReverseSubstitutes(text string) string
- type SelectorParameter
- type SelfReference
- type State
- type Statelet
- type Substitutes
- type Template
- func (t *Template) EvaluateSource(parameterState *structology.State, parentParam *expand.ViewContext, ...) (*expand.State, error)
- func (t *Template) EvaluateState(parameterState *structology.State, parentParam *expand.ViewContext, ...) (*expand.State, error)
- func (t *Template) EvaluateStateWithSession(parameterState *structology.State, parentParam *expand.ViewContext, ...) (*expand.State, error)
- func (t *Template) EvaluatorStateType() reflect.Type
- func (t *Template) Expand(placeholders *[]interface{}, SQL string, selector *Statelet, ...) (string, error)
- func (t *Template) Init(ctx context.Context, resource *Resource, view *View) error
- func (t *Template) IsActualTemplate() bool
- func (t *Template) Package() string
- func (t *Template) StateType() *structology.StateType
- type TemplateEvaluation
- type TemplateOption
- type TemplateSummary
- type TypeDefinition
- type TypeDefinitions
- type TypeDoc
- type TypesDoc
- type View
- func (v *View) AreNullValuesAllowed() bool
- func (v *View) BuildParametrizedSQL(aState state.Parameters, types *xreflect.Types, SQL string, ...) (*sqlx.SQL, error)
- func (v *View) CanUseSelectorCriteria() bool
- func (v *View) CanUseSelectorLimit() bool
- func (v *View) CanUseSelectorOffset() bool
- func (v *View) CanUseSelectorOrderBy() bool
- func (v *View) CanUseSelectorProjection() bool
- func (v *View) Collector(dest interface{}, handleMeta viewSummaryHandlerFn, supportParallel bool) *Collector
- func (v *View) ColumnByName(name string) (*Column, bool)
- func (v *View) ComponentType() reflect.Type
- func (v *View) Context(ctx context.Context) context.Context
- func (v *View) DataType() reflect.Type
- func (v *View) DatabaseType() reflect.Type
- func (v *View) Db() (*sql.DB, error)
- func (v *View) EnsureTemplate()
- func (v *View) Expand(placeholders *[]interface{}, SQL string, selector *Statelet, ...) (string, error)
- func (v *View) GetResource() *Resource
- func (v *View) GetSchema(ctx context.Context) (*state.Schema, error)
- func (v *View) IndexedColumns() NamedColumns
- func (v *View) Init(ctx context.Context, resource *Resource, opts ...Option) error
- func (v *View) InputParameters() state.Parameters
- func (v *View) IsHolder(value string) bool
- func (v *View) LookupRelation(name string) (*Relation, error)
- func (v *View) MetaTemplateEnabled() bool
- func (v *View) OutputType() reflect.Type
- func (v *View) ParamByName(name string) (*state.Parameter, error)
- func (v *View) Resource() state.Resource
- func (v *View) ResultLimit() int
- func (v *View) SetNamedType(aType reflect.Type)
- func (v *View) SetParameter(name string, selectors *State, value interface{}) error
- func (v *View) SetResource(resource *Resource)
- func (v *View) ShouldTryDiscover() bool
- func (v *View) Source() string
- func (v *View) TableAlias() string
- func (v *View) TableName() string
- func (c *View) TypeDefinitions() []*TypeDefinition
- func (v *View) UnwrapDatabaseType(ctx context.Context, value interface{}) (interface{}, error)
- func (v *View) ViewName() string
- func (v *View) Warmup() *Warmup
- type Views
- type VisitorFn
- type Warmup
Constants ¶
const ( FieldsQuery = "_fields" OffsetQuery = "_offset" LimitQuery = "_limit" CriteriaQuery = "_criteria" OrderByQuery = "_orderby" PageQuery = "_page" ContentFormat = "_format" SyncFlag = "viewSyncFlag" )
const ( //ResourceConnectors default connector resource name ResourceConnectors = "connectors" ResourceConstants = "constants" )
const ( ModeExec = Mode("SQLExec") ModeQuery = Mode("SQLQuery") ModeUnspecified = Mode("") ModeHandler = Mode("SQLHandler") AsyncJobsTable = "DATLY_JOBS" AsyncTagName = "sqlxAsync" )
Variables ¶
var ContextKey = contextKey("view")
ContextKey view context key
var Now = time.Now
var (
PingTimeInS = 15
)
var QueryStateParameters = &Config{ LimitParameter: &state.Parameter{Name: "Limit", In: state.NewQueryLocation(LimitQuery), Schema: state.NewSchema(xreflect.IntType)}, OffsetParameter: &state.Parameter{Name: "Offset", In: state.NewQueryLocation(OffsetQuery), Schema: state.NewSchema(xreflect.IntType)}, PageParameter: &state.Parameter{Name: "Page", In: state.NewQueryLocation(PageQuery), Schema: state.NewSchema(xreflect.IntType)}, FieldsParameter: &state.Parameter{Name: "Fields", In: state.NewQueryLocation(FieldsQuery), Schema: state.NewSchema(stringsType)}, OrderByParameter: &state.Parameter{Name: "OrderBy", In: state.NewQueryLocation(OrderByQuery), Schema: state.NewSchema(stringsType)}, CriteriaParameter: &state.Parameter{Name: "Criteria", In: state.NewQueryLocation(OrderByQuery), Schema: state.NewSchema(xreflect.StringType)}, SyncFlagParameter: &state.Parameter{Name: "SyncFlag", Cacheable: &trueValue, In: state.NewState(SyncFlag), Schema: state.NewSchema(boolType)}, ContentFormatParameter: &state.Parameter{Name: "ContentFormat", In: state.NewQueryLocation(ContentFormat), Schema: state.NewSchema(xreflect.StringType)}, }
Functions ¶
func AsViewParam ¶ added in v0.2.11
func AsViewParam(aView *View, aSelector *Statelet, batchData *BatchData, options ...interface{}) *expand.ViewContext
func BuildPresenceType ¶ added in v0.8.0
func BuildTree ¶ added in v0.2.11
func BuildTree(schemaType reflect.Type, slice *xunsafe.Slice, nodes interface{}, reference *SelfReference, caseFormat text.CaseFormat) interface{}
func ColumnsSchema ¶ added in v0.8.0
func ColumnsSchemaDocumented ¶ added in v0.8.0
func ColumnsSchemaDocumented(caseFormat text.CaseFormat, columns []*Column, relations []*Relation, v *View, doc state.Documentation) func() (reflect.Type, error)
func DefaultTypeName ¶ added in v0.8.0
DefaultTypeName returns a default view type name
func Description ¶ added in v0.8.0
func ExpandWithFalseCondition ¶ added in v0.2.11
func NewEvaluator ¶ added in v0.2.1
func NewEvaluator(parameters state.Parameters, stateType *structology.StateType, template string, typeLookup xreflect.LookupType, predicates []*expand.PredicateConfig) (*expand.Evaluator, error)
func NewMapBasedDoc ¶ added in v0.8.0
func NewMockSanitizer ¶ added in v0.2.11
func ResetAerospikePool ¶ added in v0.2.7
func ResetAerospikePool()
func ResetConnectionConfig ¶ added in v0.2.11
func ResetConnectionConfig()
func ResetDBPool ¶ added in v0.2.7
func ResetDBPool()
func SummaryViewKey ¶ added in v0.8.0
SummaryViewKey returns template summary key
Types ¶
type AerospikeConfig ¶ added in v0.8.0
type BatchData ¶ added in v0.2.5
type BatchData struct { ColumnNames []string Size int ParentReadSize int Values []interface{} //all values from parent ValuesBatch []interface{} //batched values defined view.Batch.Size }
func (*BatchData) ColInBatch ¶ added in v0.8.0
func (b *BatchData) ColInBatch() []interface{}
type Cache ¶ added in v0.2.2
type Cache struct { shared.Reference Name string `json:",omitempty" yaml:",omitempty"` Location string Provider string TimeToLiveMs int PartSize int `json:",omitempty"` AerospikeConfig Warmup *Warmup `json:",omitempty" yaml:",omitempty"` // contains filtered or unexported fields }
func NewRefCache ¶ added in v0.8.0
NewRefCache creates cache reference
func (*Cache) GenerateCacheInput ¶ added in v0.2.11
func (c *Cache) GenerateCacheInput(ctx context.Context) ([]*CacheInput, error)
func (*Cache) NewInput ¶ added in v0.8.0
func (c *Cache) NewInput(selector *Statelet) *CacheInput
type CacheInput ¶ added in v0.2.11
type CacheInputFn ¶ added in v0.2.11
type CacheInputFn func() ([]*CacheInput, error)
type CacheParameters ¶ added in v0.2.11
type CacheParameters struct {
Set []*ParamValue
}
type Collector ¶
type Collector struct {
// contains filtered or unexported fields
}
Collector collects and build result from View fetched from Database If View or any of the View.With MatchStrategy support Parallel fetching, it is important to call MergeData when all needed View was fetched
func NewCollector ¶
func NewCollector(slice *xunsafe.Slice, view *View, dest interface{}, viewMetaHandler viewSummaryHandlerFn, readAll bool) *Collector
NewCollector creates a collector
func (*Collector) DestPtr ¶ added in v0.8.0
func (r *Collector) DestPtr() interface{}
Project returns collector slice ptr
func (*Collector) MergeData ¶
func (r *Collector) MergeData()
MergeData merges View with Collectors produced via Relations It is sufficient to call it on the most locators Collector to produce result
func (*Collector) NewItem ¶
func (r *Collector) NewItem() func() interface{}
NewItem creates and return item provider
func (*Collector) ParentPlaceholders ¶
ParentPlaceholders if Collector doesn't support parallel fetching and has a locators, it will return a parent _field values and column name that the relation was created from, otherwise empty slice and empty string i.e. if locators Collector collects Employee{AccountId: int}, Column.Name is account_id and Collector collects Account it will extract and return all the AccountId that were accumulated and account_id
func (*Collector) ReadAll ¶ added in v0.8.0
ReadAll if Collector uses readAll flag, it means that his Relations can fetch all data View in the same time, (no matching parent data) Later on it will be merged with the parent Collector
func (*Collector) Relations ¶
Relations creates and register new Collector for each Relation present in the Template.Columns if View allows use Template.Columns
func (*Collector) ViewMetaHandler ¶ added in v0.2.11
func (*Collector) WaitIfNeeded ¶
func (r *Collector) WaitIfNeeded()
type Column ¶
type Column struct { Name string `json:",omitempty"` DataType string `json:",omitempty"` Tag string `json:",omitempty"` Expression string `json:",omitempty"` Filterable bool `json:",omitempty"` Nullable bool `json:",omitempty"` Default string `json:",omitempty"` FormatTag *format.Tag `json:",omitempty"` Codec *state.Codec `json:",omitempty"` DatabaseColumn string `json:",omitempty"` IndexedBy string `json:",omitempty"` // contains filtered or unexported fields }
Column represents View column
func (*Column) ApplyConfig ¶ added in v0.8.0
func (c *Column) ApplyConfig(config *ColumnConfig)
func (*Column) CaseFormat ¶ added in v0.8.0
func (c *Column) CaseFormat() text.CaseFormat
func (*Column) ColumnType ¶ added in v0.2.1
func (*Column) EnsureFormatTag ¶ added in v0.8.0
func (c *Column) EnsureFormatTag()
func (*Column) EnsureType ¶ added in v0.8.0
func (c *Column) EnsureType(lookupType xreflect.LookupType) error
func (*Column) Field ¶ added in v0.8.0
func (c *Column) Field() *reflect.StructField
func (*Column) SetColumnType ¶ added in v0.8.0
func (*Column) SetField ¶ added in v0.8.0
func (c *Column) SetField(field reflect.StructField)
func (*Column) SqlExpression ¶
SqlExpression builds column sql expression if any expression specified in format: Expression AS Name
func (*Column) TimeLayout ¶ added in v0.8.0
type ColumnConfig ¶ added in v0.2.2
type ColumnConfig struct { Name string `json:",omitempty"` IgnoreCaseFormatter *bool `json:",omitempty"` Expression *string `json:",omitempty"` Codec *state.Codec `json:",omitempty"` DataType *string `json:",omitempty"` Required *bool `json:",omitempty"` Format *string `json:",omitempty"` Tag *string `json:",omitempty"` Default *string `json:",omitempty"` }
type ColumnConfigs ¶ added in v0.8.0
type ColumnConfigs []*ColumnConfig
func (ColumnConfigs) Index ¶ added in v0.8.0
func (c ColumnConfigs) Index() NamedColumnConfig
type ColumnOption ¶ added in v0.8.0
type ColumnOption func(c *Column)
Column represents View column
func WithColumnTag ¶ added in v0.8.0
func WithColumnTag(tag string) ColumnOption
type Columns ¶
type Columns []*Column
Columns wrap slice of Column
func NewColumns ¶ added in v0.8.0
func (Columns) ApplyConfig ¶ added in v0.8.0
func (c Columns) ApplyConfig(configs map[string]*ColumnConfig, lookupType xreflect.LookupType) error
ApplyConfig applies column config
func (Columns) Index ¶ added in v0.2.1
func (c Columns) Index(formatCase text.CaseFormat) NamedColumns
type Config ¶
type Config struct { //TODO: Should order by be a slice? Namespace string `json:",omitempty"` OrderBy string `json:",omitempty"` Limit int `json:",omitempty"` NoLimit bool `json:",omitempty"` Constraints *Constraints `json:",omitempty"` Parameters *SelectorParameter `json:",omitempty"` LimitParameter *state.Parameter `json:",omitempty"` OffsetParameter *state.Parameter `json:",omitempty"` PageParameter *state.Parameter `json:",omitempty"` FieldsParameter *state.Parameter `json:",omitempty"` OrderByParameter *state.Parameter `json:",omitempty"` CriteriaParameter *state.Parameter `json:",omitempty"` //Settings parameters SyncFlagParameter *state.Parameter `json:",omitempty"` ContentFormatParameter *state.Parameter `json:",omitempty"` // contains filtered or unexported fields }
Config represent a View config selector
func (*Config) CloneWithNs ¶ added in v0.8.0
func (*Config) GetContentFormatParameter ¶ added in v0.8.0
func (*Config) GetSyncFlagParameter ¶ added in v0.8.0
type Connector ¶
Connector represents database/sql named connection config
func DecodeConnectors ¶ added in v0.8.0
DecodeConnectors decodes encoded connectors
func NewConnector ¶ added in v0.8.0
func NewConnector(name, driver, dsn string, opts ...ConnectorOption) *Connector
NewConnector creates a connector
func NewRefConnector ¶ added in v0.8.0
NewRefConnector creates connection reference
func (*Connector) DB ¶ added in v0.2.7
DB creates connection to the DB. It is important to not close the DB since the connection is shared.
type ConnectorOption ¶ added in v0.8.0
type ConnectorOption func(c *Connector)
Connector represents database/sql named connection config
func WithDbConfig ¶ added in v0.8.0
func WithDbConfig(dbConfig *DBConfig) ConnectorOption
func WithSecret ¶ added in v0.8.0
func WithSecret(secret *scy.Resource) ConnectorOption
type ConnectorSlice ¶
type ConnectorSlice []*Connector
ConnectorSlice represents NormalizeRepeated of *Connector
func (ConnectorSlice) Index ¶
func (c ConnectorSlice) Index() Connectors
Views indexes Connectors by Connector.Name.
func (ConnectorSlice) IndexInto ¶ added in v0.8.0
func (c ConnectorSlice) IndexInto(result *Connectors)
func (ConnectorSlice) Init ¶
func (c ConnectorSlice) Init(ctx context.Context, connectors Connectors) error
Init initializes each connector
type Connectors ¶
Connectors represents Connector registry Output was produced based on Connector.Name
func (Connectors) Lookup ¶
func (v Connectors) Lookup(name string) (*Connector, error)
Lookup returns Connector by Connector.Name
func (*Connectors) Register ¶
func (v *Connectors) Register(connector *Connector)
Register registers connector
type Constraints ¶
type Constraints struct { Criteria bool OrderBy bool Limit bool Offset bool Projection bool //enables columns projection from client (default ${NS}_fields= query param) Filterable []string SQLMethods []*Method `json:",omitempty"` Page *bool // contains filtered or unexported fields }
Constraints configure what can be selected by Statelet For each _field, default value is `false`
func (*Constraints) IsPageEnabled ¶ added in v0.8.0
func (c *Constraints) IsPageEnabled() bool
func (*Constraints) SqlMethodsIndexed ¶ added in v0.2.1
func (c *Constraints) SqlMethodsIndexed() map[string]*Method
type CriteriaParam ¶ added in v0.2.11
type DBConfig ¶ added in v0.2.7
type DBConfig struct { Name string `json:",omitempty"` Driver string `json:",omitempty"` DSN string `json:",omitempty"` MaxIdleConns int `json:",omitempty" yaml:",omitempty"` ConnMaxIdleTimeMs int `json:",omitempty" yaml:",omitempty"` MaxOpenConns int `json:",omitempty" yaml:",omitempty"` ConnMaxLifetimeMs int `json:",omitempty" yaml:",omitempty"` TimeoutTime int `json:",omitempty" yaml:",omitempty"` Secret *scy.Resource `json:",omitempty"` }
Connector represents database/sql named connection config
func (*DBConfig) ConnMaxIdleTime ¶ added in v0.2.7
ConnMaxIdleTime return connector max iddle time
func (*DBConfig) ConnMaxLifetime ¶ added in v0.2.7
ConnMaxLifetime returns connector max lifetime
type Docs ¶ added in v0.8.0
type EncodedConnector ¶ added in v0.8.0
type EncodedConnector string
EncodedConnector represents encoded connector
func (EncodedConnector) Decode ¶ added in v0.8.0
func (c EncodedConnector) Decode() (*Connector, error)
type ExpanderFn ¶ added in v0.2.11
type Field ¶
type Field struct { Name string `json:",omitempty"` Embed bool `json:",omitempty"` Column string `json:",omitempty"` FromName string `json:",omitempty"` Cardinality state.Cardinality `json:",omitempty"` Schema *state.Schema `json:",omitempty"` Fields []*Field `json:",omitempty"` Tag string `json:",omitempty"` Ptr bool Description string }
func (*Field) Init ¶
func (f *Field) Init(ctx context.Context, typeLookup xreflect.LookupType, d *TypeDefinition) error
type Link ¶ added in v0.8.0
type Link struct { Namespace string Column string Field string IncludeColumn *bool // contains filtered or unexported fields }
func (*Link) EncodeLinkTag ¶ added in v0.8.0
type MapBasedDoc ¶ added in v0.8.0
type MapBasedDoc struct {
// contains filtered or unexported fields
}
type MatchStrategy ¶
type MatchStrategy string
MatchStrategy in some cases it might be better to fetch parent View View and all Relation View in the same time and Merge it on the backend side in those cases ReadAll strategy will do that. in other cases it might be better to filter Relation View and fetch only those records that matches with View View in those cases ReadMatched will do that.
const ( ReadAll MatchStrategy = "read_all" // read all and later we match on backend side ReadMatched MatchStrategy = "read_matched" // read parent View and then filter id to match with the current View ReadDerived MatchStrategy = "read_derived" // use parent sql selector to add criteria to the relation View, this can only work if the connector of the relation View and parent View is the same )
func (MatchStrategy) ReadAll ¶ added in v0.8.0
func (s MatchStrategy) ReadAll() bool
ReadAll indicates whether MatchStrategy support parallel read.
func (MatchStrategy) Validate ¶
func (s MatchStrategy) Validate() error
Validate checks if MatchStrategy is valid
type MessageBusSlice ¶ added in v0.8.0
func (MessageBusSlice) Index ¶ added in v0.8.0
func (m MessageBusSlice) Index() MessageBuses
type MessageBuses ¶ added in v0.8.0
MessageBuses message bus map
type NamedColumnConfig ¶ added in v0.8.0
type NamedColumnConfig map[string]*ColumnConfig
type NamedColumns ¶ added in v0.8.0
NamedColumns represents *Column registry.
func (NamedColumns) Column ¶ added in v0.8.0
func (c NamedColumns) Column(name string) (codec.Column, bool)
func (NamedColumns) ColumnName ¶ added in v0.8.0
func (c NamedColumns) ColumnName(key string) (string, error)
func (NamedColumns) Lookup ¶ added in v0.8.0
func (c NamedColumns) Lookup(name string) (*Column, error)
Lookup returns Column with given name.
func (NamedColumns) Register ¶ added in v0.8.0
func (c NamedColumns) Register(caseFormat text.CaseFormat, column *Column)
Register registers *Column
func (NamedColumns) RegisterHolder ¶ added in v0.8.0
func (c NamedColumns) RegisterHolder(columnName, holder string) error
RegisterHolder looks for the Column by Relation.Column name. If it finds registers that Column with Relation.Holder key.
func (NamedColumns) RegisterWithName ¶ added in v0.8.0
func (c NamedColumns) RegisterWithName(name string, column *Column)
type NamedResources ¶ added in v0.8.0
Resource represents grouped View needed to build the View can be loaded from i.e. yaml file
type NamedViews ¶ added in v0.8.0
NamedViews represents views registry indexed by View name.
func (NamedViews) Lookup ¶ added in v0.8.0
func (v NamedViews) Lookup(viewName string) (*View, error)
Lookup returns View by given name or error if View is not present.
func (*NamedViews) Register ¶ added in v0.8.0
func (v *NamedViews) Register(view *View)
Register registers View in registry using View name.
type NamespaceView ¶ added in v0.8.0
func (*NamespaceView) SelectorParameters ¶ added in v0.8.0
type NamespacedView ¶ added in v0.8.0
type NamespacedView struct { Views []*NamespaceView // contains filtered or unexported fields }
func IndexViews ¶ added in v0.8.0
func IndexViews(aView *View) *NamespacedView
IndexViews indexes views
func (*NamespacedView) ByName ¶ added in v0.8.0
func (n *NamespacedView) ByName(ns string) *NamespaceView
func (*NamespacedView) ByNamespace ¶ added in v0.8.0
func (n *NamespacedView) ByNamespace(ns string) *NamespaceView
func (*NamespacedView) Parameters ¶ added in v0.8.0
func (n *NamespacedView) Parameters() state.NamedParameters
type Option ¶
Option defines a view option
func WithBatchSize ¶ added in v0.8.0
WithBatchSize creates an Option to set batchSize
func WithColumns ¶ added in v0.8.0
func WithConnector ¶ added in v0.8.0
WithConnector creates connector View option
func WithConnectorRef ¶ added in v0.8.0
WithConnectorRef creates connector View option
func WithCriteria ¶ added in v0.8.0
WithCriteria creates criteria constraints View option
func WithDBConfig ¶ added in v0.8.0
WithDBConfig creates connector View option
func WithMatchStrategy ¶ added in v0.8.0
WithMatchStrategy creates an Option to set MatchStrategy
func WithOneToMany ¶ added in v0.8.0
func WithOneToMany(holder string, on Links, ref *ReferenceView, opts ...RelationOption) Option
WithOneToMany creates to many relation View option
func WithOneToOne ¶ added in v0.8.0
func WithOneToOne(holder string, on Links, ref *ReferenceView, opts ...RelationOption) Option
WithOneToOne creates to one relation View option
func WithPartitioned ¶ added in v0.8.0
func WithPartitioned(partitioned *Partitioned) Option
func WithReinitialize ¶ added in v0.8.0
func WithReinitialize() Option
func WithResource ¶ added in v0.8.0
WithResource creates resource View option
func WithSchema ¶ added in v0.8.0
WithSchema creates connector View option
func WithStructTag ¶ added in v0.8.0
WithStructTag creates tag options
func WithTemplate ¶ added in v0.8.0
WithTemplate creates connector View option
func WithTransforms ¶ added in v0.8.0
func WithTransforms(transforms marshal.Transforms) Option
func WithViewKind ¶ added in v0.8.0
func WithViewType ¶ added in v0.8.0
func WithViewType(t reflect.Type, options ...state.SchemaOption) Option
WithViewType creates schema type View option
type PackagedType ¶ added in v0.8.0
PackagedType represtns a package type
func NewPackagedType ¶ added in v0.8.0
func NewPackagedType(pkg string, name string, t reflect.Type) *PackagedType
func (*PackagedType) TypeName ¶ added in v0.8.0
func (p *PackagedType) TypeName() string
TypeName returns type name
type ParamValue ¶ added in v0.2.11
type ParamValue struct { Name string Values []interface{} // contains filtered or unexported fields }
type Partitioned ¶ added in v0.8.0
type Partitioned struct { DataType string Arguments []string Concurrency int // contains filtered or unexported fields }
Partitioned represents a partitioned view
func NewPartitioned ¶ added in v0.8.0
func NewPartitioned(paritioner Partitioner, concurrency int, args ...string) *Partitioned
NewPartitioned creates a new partitioned view
func (*Partitioned) Partitioner ¶ added in v0.8.0
func (p *Partitioned) Partitioner() Partitioner
Partitioner returns the partitioner
func (*Partitioned) SetPartitioner ¶ added in v0.8.0
func (p *Partitioned) SetPartitioner(partitioner Partitioner)
SetPartitioner sets the partitioner
type Partitioner ¶ added in v0.8.0
Partitioner represents a partitioner
type Partitions ¶ added in v0.8.0
type Partitions struct { Table string Expression string Partitions [][]interface{} Partition []interface{} }
Partitions represents a partitioned view
type PredicateEvaluator ¶ added in v0.8.0
type PredicateEvaluator struct {
// contains filtered or unexported fields
}
func (*PredicateEvaluator) Evaluate ¶ added in v0.8.0
func (e *PredicateEvaluator) Evaluate(ctx *expand.Context, state *structology.State, value interface{}) (*expand.State, error)
type QuerySelector ¶ added in v0.8.0
type QuerySelector struct { //SELECTORS DatabaseFormat text.CaseFormat OutputFormat text.CaseFormat Columns []string `json:",omitempty"` Fields []string `json:",omitempty"` OrderBy string `json:",omitempty"` Offset int `json:",omitempty"` Limit int `json:",omitempty"` Criteria string `json:",omitempty"` Placeholders []interface{} `json:",omitempty"` Page int Ignore bool predicate.Filters // contains filtered or unexported fields }
Statelet allows customizing View fetched from Database
func (*QuerySelector) Add ¶ added in v0.8.0
func (s *QuerySelector) Add(fieldName string, isHolder bool)
func (*QuerySelector) CurrentLimit ¶ added in v0.8.0
func (s *QuerySelector) CurrentLimit() int
func (*QuerySelector) CurrentOffset ¶ added in v0.8.0
func (s *QuerySelector) CurrentOffset() int
func (*QuerySelector) CurrentPage ¶ added in v0.8.0
func (s *QuerySelector) CurrentPage() int
func (*QuerySelector) Has ¶ added in v0.8.0
func (s *QuerySelector) Has(field string) bool
Has checks if Field is present in Template.Columns
func (*QuerySelector) SetCriteria ¶ added in v0.8.0
func (s *QuerySelector) SetCriteria(expanded string, placeholders []interface{})
type QuerySettings ¶ added in v0.8.0
Statelet allows customizing View fetched from Database
type Reducer ¶ added in v0.8.0
type Reducer interface {
Reduce(slice interface{}) interface{}
}
Reducer represents a reducer
type ReducerProvider ¶ added in v0.8.0
ReducerProvider represents a reducer provider
type ReferenceView ¶
ReferenceView represents referenced View In our example it would be Account
func NewReferenceView ¶ added in v0.8.0
func NewReferenceView(links Links, view *View) *ReferenceView
NewReferenceView creates a reference View
func (*ReferenceView) Init ¶
func (r *ReferenceView) Init(_ context.Context, aView *View) (err error)
Init initializes ReferenceView
func (*ReferenceView) Validate ¶
func (r *ReferenceView) Validate() error
Validate checks if ReferenceView is valid
type Relation ¶
type Relation struct { Name string `json:",omitempty"` Of *ReferenceView `json:",omitempty"` Caser text.CaseFormat `json:",omitempty"` Cardinality state.Cardinality `json:",omitempty"` //IsToOne, or Many On Links Holder string `json:",omitempty"` //Represents column created due to the merging. In our example it would be Employee#Account IncludeColumn bool `json:",omitempty"` //tells if Column _field should be kept in the struct type. In our example, if set false in produced Employee would be also AccountId _field // contains filtered or unexported fields }
Relation used to build more complex View that represents database tables with relations one-to-one or many-to-many In order to understand it better our example is: locators View represents Employee{AccountId: int}, Relation represents Account{Id: int} We want to create result like: Employee{Account{Id:int}}
type RelationOption ¶ added in v0.8.0
type RelationOption func(r *Relation)
RelationOption defines relation options
type RelationsSlice ¶
type RelationsSlice []*Relation
RelationsSlice represents slice of Relation
func (RelationsSlice) PopulateWithVisitor ¶
func (r RelationsSlice) PopulateWithVisitor() []*Relation
PopulateWithVisitor filters RelationsSlice by the columns that will be present in Database, and because of that they wouldn't be resolved as unmapped columns.
type Resource ¶
type Resource struct { Metrics *Metrics SourceURL string `json:",omitempty"` CacheProviders []*Cache Connectors []*Connector MessageBuses []*mbus.Resource Views Views `json:",omitempty"` Parameters state.Parameters `json:",omitempty"` Types []*TypeDefinition Loggers logger.Adapters `json:",omitempty"` ModTime time.Time `json:",omitempty"` Predicates []*predicate.Template Substitutes Substitutes Docs *Docs // contains filtered or unexported fields }
Resource represents grouped View needed to build the View can be loaded from i.e. yaml file
func EmptyResource ¶
func EmptyResource() *Resource
func LoadResourceFromURL ¶
LoadResourceFromURL load resource from URL
func NewResource ¶
NewResource creates a Resource and register provided Types
func NewResourceFromURL ¶
func NewResourceFromURL(ctx context.Context, url string, types *xreflect.Types, codecs *codec.Registry) (*Resource, error)
NewResourceFromURL loads and initializes Resource from file .yaml
func (*Resource) AddConnector ¶ added in v0.8.0
func (r *Resource) AddConnector(name string, driver string, dsn string, opts ...ConnectorOption) *Connector
AddConnector adds connector
func (*Resource) AddConnectors ¶
AddConnectors register connectors in the resource
func (*Resource) AddLoggers ¶
AddLoggers register loggers in the resource
func (*Resource) AddMessageBus ¶ added in v0.8.0
func (*Resource) AddParameters ¶
AddParameters register parameters in the resource
func (*Resource) CacheProvider ¶ added in v0.2.7
func (*Resource) CodecByName ¶ added in v0.8.0
func (*Resource) ConnectorByName ¶
func (r *Resource) ConnectorByName() Connectors
func (*Resource) ExistsConnector ¶ added in v0.8.0
func (*Resource) GetConnectors ¶
func (r *Resource) GetConnectors() Connectors
GetConnectors returns Connectors supplied with the Resource
func (*Resource) GetViews ¶
func (r *Resource) GetViews() NamedViews
GetViews returns NamedViews supplied with the Resource
func (*Resource) IndexViews ¶ added in v0.8.0
func (r *Resource) IndexViews()
func (*Resource) LoadObject ¶ added in v0.2.1
func (*Resource) LookupParameter ¶ added in v0.8.0
func (*Resource) LookupType ¶ added in v0.8.0
func (r *Resource) LookupType() xreflect.LookupType
func (*Resource) MessageBus ¶ added in v0.8.0
func (*Resource) NamedParameters ¶ added in v0.8.0
func (r *Resource) NamedParameters() state.NamedParameters
func (*Resource) ParamByName ¶ added in v0.8.0
func (*Resource) TypeRegistry ¶ added in v0.8.0
type ResourceOptions ¶ added in v0.8.0
type ResourceOptions struct { Codecs *codec.Registry Columns map[string]Columns Types *xreflect.Types TransformsIndex marshal.TransformIndex Predicates *extension.PredicateRegistry Docs *docs.Registry Metrics *Metrics }
Resource represents grouped View needed to build the View can be loaded from i.e. yaml file
type Resourcelet ¶ added in v0.8.0
func NewResources ¶ added in v0.8.0
func NewResources(resource *Resource, view *View) *Resourcelet
func (*Resourcelet) AppendParameter ¶ added in v0.8.0
func (r *Resourcelet) AppendParameter(parameter *state.Parameter)
func (*Resourcelet) CodecOptions ¶ added in v0.8.0
func (r *Resourcelet) CodecOptions() *codec.Options
func (*Resourcelet) Codecs ¶ added in v0.8.0
func (r *Resourcelet) Codecs() *codec.Registry
func (*Resourcelet) ExpandSubstitutes ¶ added in v0.8.0
func (r *Resourcelet) ExpandSubstitutes(text string) string
func (Resourcelet) IndexedColumns ¶ added in v0.8.0
func (r Resourcelet) IndexedColumns() NamedColumns
func (*Resourcelet) LookupParameter ¶ added in v0.8.0
func (r *Resourcelet) LookupParameter(name string) (*state.Parameter, error)
func (*Resourcelet) ReverseSubstitutes ¶ added in v0.8.0
func (r *Resourcelet) ReverseSubstitutes(text string) string
type SelectorParameter ¶ added in v0.2.11
type SelectorParameter struct { Limit string `json:",omitempty"` Offset string `json:",omitempty"` Page string `json:",omitempty"` Fields string `json:",omitempty"` OrderBy string `json:",omitempty"` Criteria string `json:",omitempty"` SyncFlag string `json:",omitempty"` }
Config represent a View config selector
type SelfReference ¶ added in v0.2.11
type State ¶ added in v0.8.0
State represents view statelet registry
func (*State) Lookup ¶ added in v0.8.0
Lookup returns and initializes Statelet attached to View. Creates new one if doesn't exist.
func (*State) QuerySelector ¶ added in v0.8.0
func (s *State) QuerySelector(view *View) *QuerySelector
QuerySelector returns query selector
func (*State) QuerySettings ¶ added in v0.8.0
func (s *State) QuerySettings(view *View) *QuerySettings
QuerySettings returns query settings
type Statelet ¶ added in v0.8.0
type Statelet struct { Template *structology.State QuerySelector QuerySettings }
InputType represents view state
func (*Statelet) IgnoreRead ¶ added in v0.8.0
func (s *Statelet) IgnoreRead()
type Substitutes ¶ added in v0.8.0
func (Substitutes) Keys ¶ added in v0.8.0
func (s Substitutes) Keys() []string
func (Substitutes) Replace ¶ added in v0.8.0
func (s Substitutes) Replace(text string) string
func (Substitutes) ReverseReplace ¶ added in v0.8.0
func (s Substitutes) ReverseReplace(text string) string
type Template ¶
type Template struct { Source string `json:",omitempty" yaml:"source,omitempty"` SourceURL string `json:",omitempty" yaml:"sourceURL,omitempty"` Schema *state.Schema `json:",omitempty" yaml:"schema,omitempty"` Parameters state.Parameters `json:",omitempty" yaml:"parameters,omitempty"` Summary *TemplateSummary `json:",omitempty" yaml:",omitempty"` // contains filtered or unexported fields }
func NewTemplate ¶ added in v0.8.0
func NewTemplate(source string, opts ...TemplateOption) *Template
NewTemplate creates a template
func (*Template) EvaluateSource ¶
func (t *Template) EvaluateSource(parameterState *structology.State, parentParam *expand.ViewContext, batchData *BatchData, options ...interface{}) (*expand.State, error)
func (*Template) EvaluateState ¶ added in v0.8.0
func (t *Template) EvaluateState(parameterState *structology.State, parentParam *expand.ViewContext, batchData *BatchData, options ...interface{}) (*expand.State, error)
func (*Template) EvaluateStateWithSession ¶ added in v0.8.0
func (*Template) EvaluatorStateType ¶ added in v0.8.0
func (*Template) IsActualTemplate ¶ added in v0.2.1
func (*Template) StateType ¶ added in v0.8.0
func (t *Template) StateType() *structology.StateType
type TemplateEvaluation ¶ added in v0.2.11
type TemplateEvaluation struct { SQL string Evaluated bool Expander ExpanderFn Args []interface{} }
type TemplateOption ¶ added in v0.8.0
type TemplateOption func(t *Template)
func WithTemplateParameters ¶ added in v0.8.0
func WithTemplateParameters(parameters ...*state.Parameter) TemplateOption
WithTemplateParameters return parameter template options
func WithTemplateSchema ¶ added in v0.8.0
func WithTemplateSchema(schema *state.Schema) TemplateOption
WithTemplateSchema returns with template schema
type TemplateSummary ¶ added in v0.8.0
type TemplateSummary struct { SourceURL string Source string Name string Kind MetaKind Cardinality state.Cardinality Columns Columns Schema *state.Schema // contains filtered or unexported fields }
func (*TemplateSummary) EnsureSchema ¶ added in v0.8.0
func (m *TemplateSummary) EnsureSchema()
func (*TemplateSummary) Evaluate ¶ added in v0.8.0
func (m *TemplateSummary) Evaluate(parameterState *structology.State, viewParam *expand.ViewContext) (string, []interface{}, error)
type TypeDefinition ¶ added in v0.8.0
type TypeDefinition struct { shared.Reference `json:",omitempty" ` Name string `json:",omitempty" yaml:"Name" ` Alias string `json:",omitempty"` Fields []*Field `json:",omitempty"` Schema *state.Schema `json:",omitempty"` DataType string `json:",omitempty" yaml:"DataType" ` Cardinality state.Cardinality `json:",omitempty" yaml:"Cardinality" ` Package string `json:",omitempty" yaml:"Package" ` ModulePath string `json:",omitempty" yaml:"ModulePath" ` Ptr bool `json:",omitempty" yaml:"Ptr" ` CustomType bool `json:",omitempty"` // contains filtered or unexported fields }
func (*TypeDefinition) AddField ¶ added in v0.8.0
func (d *TypeDefinition) AddField(field *Field)
func (*TypeDefinition) Init ¶ added in v0.8.0
func (d *TypeDefinition) Init(ctx context.Context, lookupType xreflect.LookupType) error
func (*TypeDefinition) Type ¶ added in v0.8.0
func (d *TypeDefinition) Type() reflect.Type
func (*TypeDefinition) TypeName ¶ added in v0.8.0
func (d *TypeDefinition) TypeName() string
type TypeDefinitions ¶ added in v0.8.0
type TypeDefinitions []*TypeDefinition
func (TypeDefinitions) Exclude ¶ added in v0.8.0
func (d TypeDefinitions) Exclude(candidates ...string) TypeDefinitions
type View ¶
type View struct { shared.Reference Mode Mode `json:",omitempty"` Connector *Connector `json:",omitempty"` Standalone bool `json:",omitempty"` Name string `json:",omitempty"` Description string `json:",omitempty"` Module string `json:",omitempty"` Alias string `json:",omitempty"` Table string `json:",omitempty"` From string `json:",omitempty"` FromURL string `json:",omitempty"` Exclude []string `json:",omitempty"` Columns []*Column `json:",omitempty"` Partitioned *Partitioned Criteria string `json:",omitempty"` Selector *Config `json:",omitempty"` Template *Template `json:",omitempty"` Schema *state.Schema `json:",omitempty"` With []*Relation `json:",omitempty"` MatchStrategy MatchStrategy `json:",omitempty"` Batch *Batch `json:",omitempty"` Logger *logger.Adapter `json:",omitempty"` Counter logger.Counter `json:"-"` CaseFormat text.CaseFormat `json:",omitempty"` DiscoverCriteria *bool `json:",omitempty"` AllowNulls *bool `json:",omitempty"` Cache *Cache `json:",omitempty"` ColumnsConfig map[string]*ColumnConfig `json:",omitempty"` SelfReference *SelfReference `json:",omitempty"` TableBatches map[string]bool `json:",omitempty"` // contains filtered or unexported fields }
View represents a View
func NewExecView ¶ added in v0.8.0
func NewExecView(name, table string, template string, parameters []*state.Parameter, opts ...Option) *View
NewExecView creates an execution View
func NewRefView ¶ added in v0.8.0
func (*View) AreNullValuesAllowed ¶ added in v0.2.11
func (*View) BuildParametrizedSQL ¶ added in v0.8.0
func (*View) CanUseSelectorCriteria ¶
CanUseSelectorCriteria indicates if Template.Criteria can be used
func (*View) CanUseSelectorLimit ¶
CanUseSelectorLimit indicates if Template.Limit can be used
func (*View) CanUseSelectorOffset ¶
CanUseSelectorOffset indicates if Template.Offset can be used
func (*View) CanUseSelectorOrderBy ¶
CanUseSelectorOrderBy indicates if Template.OrderBy can be used
func (*View) CanUseSelectorProjection ¶ added in v0.2.2
CanUseSelectorProjection indicates if Template.Fields can be used
func (*View) Collector ¶
func (v *View) Collector(dest interface{}, handleMeta viewSummaryHandlerFn, supportParallel bool) *Collector
Collector creates new Collector for View.DataType
func (*View) ColumnByName ¶
ColumnByName returns Column by Column.Name
func (*View) ComponentType ¶ added in v0.8.0
func (*View) DatabaseType ¶ added in v0.2.2
func (*View) EnsureTemplate ¶ added in v0.8.0
func (v *View) EnsureTemplate()
func (*View) GetResource ¶ added in v0.8.0
func (*View) IndexedColumns ¶
func (v *View) IndexedColumns() NamedColumns
IndexedColumns returns Columns
func (*View) Init ¶
Init initializes View using View provided in Resource. i.e. If View, Connector etc. should inherit from others - it has te bo included in Resource. It is important to call Init for every View because it also initializes due to the optimization reasons.
func (*View) InputParameters ¶ added in v0.8.0
func (v *View) InputParameters() state.Parameters
func (*View) LookupRelation ¶ added in v0.8.0
func (*View) MetaTemplateEnabled ¶ added in v0.2.11
func (*View) OutputType ¶ added in v0.8.0
OutputType returns reader view output type
func (*View) ParamByName ¶ added in v0.2.11
func (*View) ResultLimit ¶ added in v0.8.0
func (*View) SetNamedType ¶ added in v0.8.0
func (*View) SetParameter ¶ added in v0.8.0
SetParameter sets a View or relation parameter, for relation name has to be prefixed relName:paramName
func (*View) SetResource ¶ added in v0.8.0
func (*View) ShouldTryDiscover ¶ added in v0.2.1
func (*View) Source ¶
Source returns database View source. It prioritizes From, Table then View.Name
func (*View) TableAlias ¶ added in v0.8.0
func (*View) TypeDefinitions ¶ added in v0.8.0
func (c *View) TypeDefinitions() []*TypeDefinition
func (*View) UnwrapDatabaseType ¶ added in v0.2.2
type Views ¶
type Views []*View
Views wraps slice of NamedViews
func (Views) EnsureResource ¶ added in v0.8.0
func (Views) Index ¶ added in v0.8.0
func (v Views) Index() NamedViews
Index indexes Views by View.Name
Source Files ¶
- batch.go
- cache.go
- codec.go
- collector.go
- column.go
- columns.go
- config.go
- connector.go
- connectors.go
- definition.go
- docs.go
- match.go
- mbus.go
- metric.go
- names.go
- option.go
- partition.go
- pool.go
- predicate.go
- relation.go
- resource.go
- resourslet.go
- sql.go
- state.go
- substitutes.go
- summary.go
- tag.go
- template.go
- time.go
- types.go
- view.go
- views.go