Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildFieldPath ¶
BuildFieldPath returns the full fields tree path to a field
Types ¶
type ElasticsearchAdvancedSettings ¶
type ElasticsearchAdvancedSettings map[string]interface{}
ElasticsearchAdvancedSettings is a wrapper for advanced elasticsearch template settings like "number_of_shards", "number_of_replica", etc.
type ElasticsearchOptions ¶
type ElasticsearchOptions struct { // Rollmode can only be "rollover" atm Rollmode string `json:"rollmode"` Rollcron string `json:"rollcron"` EnablePurge bool `json:"enablePurge"` PurgeMaxConcurrentIndices int `json:"purgeMaxConcurrentIndices"` PatchAliasMaxIndices int `json:"patchAliasMaxIndices"` AdvancedSettings ElasticsearchAdvancedSettings `json:"advancedSettings,omitempty"` }
ElasticsearchOptions regroups every elasticsearch specific options
func (ElasticsearchOptions) IsValid ¶
func (eso ElasticsearchOptions) IsValid() (bool, error)
IsValid checks if a model elasticsearch options is valid and has no missing mandatory fields
type FieldLeaf ¶
type FieldLeaf struct { Name string `json:"name"` Ftype FieldType `json:"type"` Semantic bool `json:"semantic"` Synonyms []string `json:"synonyms"` }
FieldLeaf implements Field interface and represents a terminal node (or primitive type) in the modeler mapping
type FieldObject ¶
type FieldObject struct { Name string `json:"name"` Ftype FieldType `json:"type"` KeepObjectSeparation bool `json:"keepObjectSeparation"` Fields []Field `json:"fields"` }
FieldObject implements Field interface and represents a non-terminal node (or object) in the modeler mapping
func (*FieldObject) IsValid ¶
func (field *FieldObject) IsValid() (bool, error)
IsValid checks if a model definition is valid and has no missing mandatory fields
func (*FieldObject) Source ¶
func (field *FieldObject) Source() (string, map[string]interface{})
Source (FieldObject) returns a elasticsearch field with a name and a slice of attributes It mainly manages "object" and "nested" elasticsearch data type
func (*FieldObject) UnmarshalJSON ¶
func (field *FieldObject) UnmarshalJSON(b []byte) error
UnmarshalJSON (FieldObject) unmarshall a JSON byte slice in FieldObject struct
type FieldType ¶
type FieldType int
FieldType is an enumeration of all allowed types in the modeler mapping
const ( // String is elasticsearch keyword datatype String FieldType = iota + 1 // Int is elasticsearch integer datatype Int // Float is elasticsearch float datatype Float // DateTime is elasticsearch date datatype with specific format {"type": "date", "format": "date_hour_minute_second_millis"} DateTime // Boolean is elasticsearch boolean datatype Boolean // Object is elasticsearch object or nested datatype (based on some other attributes) Object )
func (FieldType) MarshalJSON ¶
MarshalJSON marshals the enum as a quoted json string
func (*FieldType) UnmarshalJSON ¶
UnmarshalJSON unmashals a quoted json string to the enum value
type Model ¶
type Model struct { ID int64 `json:"id"` Name string `json:"name"` Synonyms []string `json:"synonyms"` Fields []Field `json:"fields"` Source string `json:"source,omitempty"` ElasticsearchOptions ElasticsearchOptions `json:"elasticsearchOptions"` }
Model represents a business entity model
func (*Model) IsValid ¶
IsValid checks if a model definition is valid and has no missing mandatory fields
func (*Model) ToElasticsearchMappingProperties ¶
ToElasticsearchMappingProperties converts a modeler mapping to an elasticsearch mapping
func (*Model) UnmarshalJSON ¶
UnmarshalJSON unmarshal a quoted json string to a Model instance