Documentation
¶
Overview ¶
Copyright 2019 txn2 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
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, error)
- func (a *Api) SearchModelsHandler(c *gin.Context)
- func (a *Api) UpsertModel(account string, model *Model) (int, es.Result, error)
- func (a *Api) UpsertModelHandler(c *gin.Context)
- type Config
- type Model
- type ModelResult
- type ModelSearchResults
- type ModelSearchResultsAck
Constants ¶
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
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 {
// 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"`
// 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 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
