Documentation
¶
Overview ¶
Package translator implements dql to datly rule translator
Index ¶
- func ExtractConnectorRef(SQL *string) string
- func MatchByName(types []*xreflect.Type, name string) *xreflect.Type
- func SafeQueryStringify(aQuery *query.Select) (SQL string, err error)
- type Config
- type OutputSettings
- type Repository
- func (r *Repository) ContentBaseURL(rule *options.Rule) string
- func (r *Repository) DocBaseURL() string
- func (r *Repository) Init(ctx context.Context) error
- func (r *Repository) LookupDb(name string) (*sql.DB, error)
- func (r *Repository) PersistConfig() error
- func (r *Repository) RuleBaseURL(rule *options.Rule) string
- func (r *Repository) RuleName(rule *options.Rule) string
- func (r *Repository) Upload(ctx context.Context) error
- func (r *Repository) UploadPartialRules(ctx context.Context) error
- type Resource
- func (r *Resource) AddCustomTypeURL(URL string)
- func (r *Resource) AdjustCustomType()
- func (r *Resource) AppendTypeDefinition(typeDef *view.TypeDefinition)
- func (r *Resource) AppendTypeDefinitions(typeDefs []*view.TypeDefinition)
- func (r *Resource) CacheRef() string
- func (r *Resource) DataFieldName(inInput bool) string
- func (r *Resource) ExtractDeclared(dSQL *string) (err error)
- func (r *Resource) GetSchema(dataType string, opts ...xreflect.Option) (*state.Schema, error)
- func (r *Resource) GetURI() string
- func (r *Resource) ImpliedKind() state.Kind
- func (r *Resource) IncludeSnippets(ctx context.Context, fs afs.Service, dSQL *string) error
- func (r *Resource) IncludeURL(ctx context.Context, URL string, fs afs.Service) (string, error)
- func (r *Resource) InitRule(dSQL *string, ctx context.Context, fs afs.Service, opts *options.Options) error
- func (n Resource) Lookup(viewName string) *indexNamespace
- func (n Resource) LookupNs(namespace string) *indexNamespace
- func (r *Resource) LookupTypeDef(typeName string) *view.TypeDefinition
- func (r *Resource) OptionRule() *options.Rule
- func (r *Resource) TypePackage(name string) string
- type RouterConfig
- type Rule
- func (r *Rule) DSQLSetting() interface{}
- func (r *Rule) ExtractSettings(dSQL *string) error
- func (r *Rule) GetField() string
- func (r *Rule) IsBasic() bool
- func (r *Rule) IsMany() bool
- func (r *Rule) IsReader() bool
- func (n Rule) LookupNs(namespace string) *indexNamespace
- func (r *Rule) RootView() *View
- func (r *Rule) RootViewlet() *Viewlet
- func (r *Rule) ShallGenerateHandler() bool
- func (r *Rule) StateTypePackage() string
- type Service
- func (s *Service) DefaultConnector(rule *options.Rule) string
- func (s *Service) Init(ctx context.Context) error
- func (s *Service) InitSignature(ctx context.Context, rule *options.Rule) (err error)
- func (s *Service) Translate(ctx context.Context, rule *options.Rule, dSQL string, opts *options.Options) (err error)
- type Substitutes
- type TypeImport
- type View
- type Viewlet
- type Viewlets
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractConnectorRef ¶
Types ¶
type Config ¶
type Config struct {
*standalone.Config
// contains filtered or unexported fields
}
func NewConfig ¶
func NewConfig(repository *options.Repository) *Config
func (*Config) NormalizeURL ¶
type OutputSettings ¶
type OutputSettings struct {
Kind string
Cardinality state.Cardinality
DataType string
Title string
}
func (*OutputSettings) IsToOne ¶
func (o *OutputSettings) IsToOne() bool
func (*OutputSettings) ViewCardinality ¶
func (o *OutputSettings) ViewCardinality() state.Cardinality
type Repository ¶
type Repository struct {
Config *Config
Resource []*Resource
State inference.State
Connectors []*view.Connector
NamedConnectors view.Connectors
Caches view.Caches
MessageBuses []*mbus.Resource
Messages msg.Messages
Files asset.Files
Substitutes Substitutes
PersistAssets bool
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository(config *Config) *Repository
func (*Repository) ContentBaseURL ¶
func (r *Repository) ContentBaseURL(rule *options.Rule) string
func (*Repository) DocBaseURL ¶ added in v0.10.3
func (r *Repository) DocBaseURL() string
func (*Repository) Init ¶
func (r *Repository) Init(ctx context.Context) error
Init Initialises translator repository
func (*Repository) PersistConfig ¶
func (r *Repository) PersistConfig() error
func (*Repository) RuleBaseURL ¶
func (r *Repository) RuleBaseURL(rule *options.Rule) string
func (*Repository) UploadPartialRules ¶
func (r *Repository) UploadPartialRules(ctx context.Context) error
UploadPartialRules uploads rule into dest, this is temporary to see signature for component parameters
type Resource ¶
type Resource struct {
Generated bool
Resource view.Resource
State inference.State
OutputState inference.State
AsyncState inference.State
Rule *Rule
tparser.Statements
RawSQL string
UseCustomTypes bool
Declarations *tparser.Declarations
CustomTypeURLs []string
Module *modfile.Module
ModuleLocation string
// contains filtered or unexported fields
}
func NewResource ¶
func (*Resource) AddCustomTypeURL ¶
func (*Resource) AdjustCustomType ¶
func (r *Resource) AdjustCustomType()
func (*Resource) AppendTypeDefinition ¶
func (r *Resource) AppendTypeDefinition(typeDef *view.TypeDefinition)
func (*Resource) AppendTypeDefinitions ¶
func (r *Resource) AppendTypeDefinitions(typeDefs []*view.TypeDefinition)
func (*Resource) DataFieldName ¶ added in v0.10.0
func (*Resource) ExtractDeclared ¶
ExtractDeclared extract both parameter declaration and transform expression
func (*Resource) ImpliedKind ¶
func (*Resource) IncludeSnippets ¶
func (*Resource) IncludeURL ¶
func (*Resource) LookupTypeDef ¶
func (r *Resource) LookupTypeDef(typeName string) *view.TypeDefinition
LookupTypeDef returns matched type definition
func (*Resource) OptionRule ¶ added in v0.14.2
func (*Resource) TypePackage ¶
type RouterConfig ¶
type Rule ¶
type Rule struct {
Viewlets
Name string `json:",omitempty" yaml:"Name"` // name of the MCP
Description string `json:",omitempty" yaml:"Description"` // optional description for documentation purposes
contract.ModelContextProtocol
CustomValidation bool
IgnoreEmptyQueryParameters bool
Root string
//TODO replace with repository.Component and path.Settings ?
router.Route
*contract.Output
Connector string `json:",omitempty"`
Async *async.Config `json:",omitempty"`
Cache *view.Cache `json:",omitempty"`
CSV *content.CSVConfig `json:",omitempty"`
Const map[string]interface {
} `json:",omitempty"`
ConstURL string `json:",omitempty"`
DocURL string
DocURLs []string
Doc view.Documentation
TypeSrc *parser.TypeImport `json:",omitempty"`
Package string `json:",omitempty"`
Router *RouterConfig `json:",omitempty" yaml:",omitempty"`
DataFormat string `json:",omitempty"`
TabularJSON *content.TabularJSONConfig `json:",omitempty"`
XML *content.XMLConfig `json:",omitempty"`
Type string `json:",omitempty"`
HandlerArgs []string `json:",omitempty"`
InputType string `json:",omitempty"`
OutputType string `json:",omitempty"`
MessageBus string `json:",omitempty"`
CompressAboveSize int `json:",omitempty"`
With []string `json:",omitempty"`
Include []string `json:",omitempty"`
IsGeneratation bool
XMLUnmarshalType string `json:",omitempty"`
JSONUnmarshalType string `json:",omitempty"`
JSONMarshalType string `json:",omitempty"`
OutputParameter *inference.Parameter
// contains filtered or unexported fields
}
func (*Rule) DSQLSetting ¶
func (r *Rule) DSQLSetting() interface{}
func (*Rule) ExtractSettings ¶
func (*Rule) RootViewlet ¶
func (*Rule) ShallGenerateHandler ¶
func (*Rule) StateTypePackage ¶
type Service ¶
type Service struct {
Repository *Repository //TODO init repo with basic config and dependencies
Plugins []*options.Plugin
// contains filtered or unexported fields
}
func (*Service) InitSignature ¶
type Substitutes ¶
type Substitutes map[string]view.Substitutes
func (Substitutes) Merge ¶
func (s Substitutes) Merge() view.Substitutes
func (Substitutes) Replace ¶
func (s Substitutes) Replace(text string) string
func (Substitutes) ReverseReplace ¶
func (s Substitutes) ReverseReplace(text string) string
type TypeImport ¶
type View ¶
type View struct {
Namespace string
view.View
ExecKind string `json:",omitempty"`
FetchRecords bool `json:",omitempty"`
Connector string `json:",omitempty"`
Self *view.SelfReference `json:",omitempty"`
Warmup map[string]interface{} `json:",omitempty"`
Auth string `json:",omitempty"`
DataType string `json:",omitempty"`
AsyncTableName string `json:",omitempty"`
ParameterDerived bool
Cardinality string
// contains filtered or unexported fields
}
func (*View) GenerateFiles ¶
type Viewlet ¶
type Viewlet struct {
Name string
Holder string
Connector string
SQL string
SanitizedSQL string
Expanded *sqlx.SQL
Resource *Resource
Table *inference.Table
Join *query.Join
Spec *inference.Spec
OutputJSONHint string
ViewJSONHint string
TableJSONHint string
Exclude []string
Whitelisted []string
ColumnConfig view.ColumnConfigs
View *View
TypeDefinition *view.TypeDefinition
OutputSettings
Columns view.Columns
Summary *Viewlet
IsSummary bool
// contains filtered or unexported fields
}
func (*Viewlet) GetConnector ¶ added in v0.9.7
func (*Viewlet) IsMetaView ¶
func (*Viewlet) NormalizeSQL ¶ added in v0.10.1
func (v *Viewlet) NormalizeSQL()
func (*Viewlet) UpdateParameterType ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.