Documentation
¶
Overview ¶
Package tm implements Type Models for txn2 projects.
Index ¶
- Constants
- func GetModelsTemplateMapping() es.IndexTemplate
- func MakeModelTemplateMapping(account string, model *Model) es.IndexTemplate
- type Api
- func (a *Api) GetModel(account string, id string) (int, *ModelResult, error)
- func (a *Api) GetModelHandler(c *gin.Context)
- func (a *Api) SearchModels(account string, searchObj *es.Obj) (int, ModelSearchResults, *es.ErrorResponse, error)
- func (a *Api) SearchModelsHandler(c *gin.Context)
- func (a *Api) UpsertModel(account string, model *Model) (int, es.Result, *es.ErrorResponse, error)
- func (a *Api) UpsertModelHandler(c *gin.Context)
- type Config
- type Model
- type ModelResult
- type ModelResultAck
- type ModelSearchResults
- type ModelSearchResultsAck
Constants ¶
View Source
const IdxModel = "models"
Variables ¶
This section is empty.
Functions ¶
func GetModelsTemplateMapping ¶
func GetModelsTemplateMapping() es.IndexTemplate
GetModelsTemplateMapping
func MakeModelTemplateMapping ¶
func MakeModelTemplateMapping(account string, model *Model) es.IndexTemplate
MakeModelTemplateMapping creates a template for modeled data coming in from rxtx.
Types ¶
type Api ¶
type Api struct {
*Config
}
Api
func (*Api) SearchModels ¶ added in v0.0.4
func (a *Api) SearchModels(account string, searchObj *es.Obj) (int, ModelSearchResults, *es.ErrorResponse, error)
SearchModels
func (*Api) SearchModelsHandler ¶ added in v0.0.4
SearchAccountsHandler
func (*Api) UpsertModel ¶
UpsertModel
func (*Api) UpsertModelHandler ¶
UpsertModelHandler
type Config ¶
type Config struct {
Logger *zap.Logger
HttpClient *micro.Client
// used for communication with Elasticsearch
// if nil, HttpClient will be used.
Elastic *es.Client
ElasticServer string
}
Config
type Model ¶
type Model struct {
// MachineName is a lowercase under score delimited uniq id
MachineName string `json:"machine_name" mapstructure:"machine_name"`
// short human readable display name
DisplayName string `json:"display_name" mapstructure:"display_name"`
// a single sentence description
BriefDescription string `json:"description_brief" mapstructure:"description_brief"`
// full documentation in markdown
Description string `json:"description" mapstructure:"description"`
// default value expressed as a string
DefaultValue string `json:"default_value" mapstructure:"default_value"`
// integer, float, date, binary, text and keyword
DataType string `json:"data_type" mapstructure:"data_type"`
// used for data formats
Format string `json:"format" mapstructure:"format"`
// named parsers
Parsers []string `json:"parsers" mapstructure:"parsers"`
// belongs to a class of models
TypeClass string `json:"type_class" mapstructure:"type_class"`
// groups models
Group string `json:"group" mapstructure:"group"`
// false to ignore inbound parsing
Parse bool `json:"parse" mapstructure:"parse"`
// used by parsers of element ordered inbound data
Index int `json:"index" mapstructure:"index"`
// children of this model
Fields []Model `json:"fields" mapstructure:"fields"`
}
Model
type ModelResult ¶
ModelResult returned from Elastic
type ModelResultAck ¶ added in v0.0.11
type ModelResultAck struct {
ack.Ack
Payload ModelResult `json:"payload"`
}
ModelResultAck
type ModelSearchResults ¶ added in v0.0.4
type ModelSearchResults struct {
es.SearchResults
Hits struct {
Total int `json:"total"`
MaxScore float64 `json:"max_score"`
Hits []ModelResult `json:"hits"`
} `json:"hits"`
}
ModelSearchResults
type ModelSearchResultsAck ¶ added in v0.0.4
type ModelSearchResultsAck struct {
ack.Ack
Payload ModelSearchResults `json:"payload"`
}
AccountSearchResultsAck
Click to show internal directories.
Click to hide internal directories.