Documentation ¶
Index ¶
- Variables
- type Builder
- func (b *Builder) Build(ctx context.Context, opts ...BuilderOption) (*cache.ParmetrizedQuery, error)
- func (b *Builder) CacheMetaSQL(ctx context.Context, aView *view.View, selector *view.Statelet, ...) (*cache.ParmetrizedQuery, error)
- func (b *Builder) CacheSQL(ctx context.Context, aView *view.View, selector *view.Statelet) (*cache.ParmetrizedQuery, error)
- func (b *Builder) CacheSQLWithOptions(ctx context.Context, aView *view.View, statelet *view.Statelet, ...) (*cache.ParmetrizedQuery, error)
- func (b *Builder) ExactMetaSQL(ctx context.Context, aView *view.View, selector *view.Statelet, ...) (*cache.ParmetrizedQuery, error)
- type BuilderOption
- func WithBuilderBatchData(batchData *view.BatchData) BuilderOption
- func WithBuilderExclude(columnsIn, pagination bool) BuilderOption
- func WithBuilderExpander(expander expand.Expander) BuilderOption
- func WithBuilderParent(parent *expand.ViewContext) BuilderOption
- func WithBuilderPartitions(partitions *view.Partitions) BuilderOption
- func WithBuilderRelation(relation *view.Relation) BuilderOption
- func WithBuilderStatelet(statelet *view.Statelet) BuilderOption
- func WithBuilderView(view *view.View) BuilderOption
- type Event
- type Exclude
- type OnFetcher
- type OnRelationer
- type Option
- func WithCacheDisabled(flag bool) Option
- func WithCacheRefresh() Option
- func WithCriteria(whereClause string, parameters ...interface{}) Option
- func WithDryRun() Option
- func WithIncludeSQL(flag bool) Option
- func WithMetrics(metrics *response.Metrics) Option
- func WithParameter(name string, value interface{}) Option
- func WithParent(parent *view.View) Option
- func WithResourceState(states *view.State) Option
- func WithRevealMetric(flag bool) Option
- type Output
- type ParentData
- type Service
- func (s *Service) BuildCriteria(ctx context.Context, value interface{}, options *codec.CriteriaBuilderOptions) (*codec.Criteria, error)
- func (s *Service) HandleSQLError(err error, session *Session, aView *view.View, matcher *cache.ParmetrizedQuery, ...) (*response.SQLExecution, error)
- func (s *Service) NewExecutionInfo(session *Session, index *cache.ParmetrizedQuery, cacheStats *cache.Stats, ...) *response.SQLExecution
- func (s *Service) Read(ctx context.Context, session *Session) error
- func (s *Service) ReadInto(ctx context.Context, dest interface{}, aView *view.View, opts ...Option) error
- type Session
- func (s *Session) AddCriteria(aView *view.View, criteria string, placeholders ...interface{})
- func (s *Session) AddMetric(m *response.Metric)
- func (s *Session) HandleViewMeta(meta interface{}) error
- func (s *Session) Init() error
- func (s *Session) IsCacheEnabled(aView *view.View) bool
- func (s *Session) Lookup(v *view.View) *structology.State
- func (s *Session) ParentData() (*ParentData, bool)
Constants ¶
This section is empty.
Variables ¶
var Dif = func(t1, t2 time.Time) time.Duration {
return t1.Sub(t2)
}
var Now = time.Now
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct{}
Builder represent SQL Builder
func (*Builder) Build ¶
func (b *Builder) Build(ctx context.Context, opts ...BuilderOption) (*cache.ParmetrizedQuery, error)
Build builds SQL Select statement
func (*Builder) CacheMetaSQL ¶
func (*Builder) CacheSQLWithOptions ¶
type BuilderOption ¶
type BuilderOption func(*builderOptions)
func WithBuilderBatchData ¶
func WithBuilderBatchData(batchData *view.BatchData) BuilderOption
WithBuilderBatchData with batch data
func WithBuilderExclude ¶
func WithBuilderExclude(columnsIn, pagination bool) BuilderOption
WithExcludeAll excludes all
func WithBuilderExpander ¶
func WithBuilderExpander(expander expand.Expander) BuilderOption
WithBuilderExpander sets expander
func WithBuilderParent ¶
func WithBuilderParent(parent *expand.ViewContext) BuilderOption
WithBuilderParent sets parent
func WithBuilderPartitions ¶
func WithBuilderPartitions(partitions *view.Partitions) BuilderOption
func WithBuilderRelation ¶
func WithBuilderRelation(relation *view.Relation) BuilderOption
WithBuilderRelation sets relation
func WithBuilderStatelet ¶
func WithBuilderStatelet(statelet *view.Statelet) BuilderOption
WithBuilderStatelet set statelet
func WithBuilderView ¶
func WithBuilderView(view *view.View) BuilderOption
WithBuilderView sets view
type OnFetcher ¶
OnFetcher lifecycle interface that if entity implements, OnFetch(ctx context.NormalizeObject) is call after record is fetched from db
type OnRelationer ¶
OnRelationer lifecycle interface that if entity implements, OnRelation(ctx context.NormalizeObject) is call after relation is assembled
type Option ¶
Option represents a session option
func WithCacheRefresh ¶
func WithCacheRefresh() Option
func WithCriteria ¶
WithCriteria returns criteria option
func WithMetrics ¶
WithMetrics returns with dry run option
func WithParameter ¶
WithParameter returns set parameter option
func WithResourceState ¶
WithResourceState returns states option
func WithRevealMetric ¶
type Output ¶
type Output struct { Data interface{} DataType reflect.Type DataPtr interface{} //slice pointer DataSummary interface{} Metrics response.Metrics Filters predicate.Filters //filter used by request }
Session groups view required to Read view
type ParentData ¶
Session groups view required to Read view
func (*ParentData) AsParam ¶
func (d *ParentData) AsParam() *expand.ViewContext
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service represents reader service
func (*Service) BuildCriteria ¶
func (*Service) HandleSQLError ¶
func (s *Service) HandleSQLError(err error, session *Session, aView *view.View, matcher *cache.ParmetrizedQuery, stats *response.SQLExecution) (*response.SQLExecution, error)
func (*Service) NewExecutionInfo ¶
func (s *Service) NewExecutionInfo(session *Session, index *cache.ParmetrizedQuery, cacheStats *cache.Stats, cacheError error) *response.SQLExecution
type Session ¶
type Session struct { IncludeSQL bool CacheDisabled bool RevealMetric bool CacheRefresh cache.Refresh DryRun bool View *view.View State *view.State Parent *view.View Output MetricPtr *response.Metrics // contains filtered or unexported fields }
Session groups view required to Read view
func NewSession ¶
NewSession creates a session
func (*Session) AddCriteria ¶
AddCriteria adds the supplied view criteria
func (*Session) HandleViewMeta ¶
func (*Session) ParentData ¶
func (s *Session) ParentData() (*ParentData, bool)