Documentation ¶
Index ¶
- func BuildFieldPath(name string, fields []Field) string
- func FindFieldLeaf(search string, parent string, fields []Field) bool
- type ElasticsearchOptions
- type Field
- type FieldLeaf
- type FieldObject
- type FieldType
- type IndexIntervalType
- type Model
- type RollmodeSettings
- type RollmodeType
- type TimebasedSettings
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 ElasticsearchOptions ¶
type ElasticsearchOptions struct { // Rollmode can only be "rollover" atm Rollmode RollmodeSettings `json:"rollmode"` Rollcron string `json:"rollcron"` EnablePurge bool `json:"enablePurge"` PurgeMaxConcurrentIndices int `json:"purgeMaxConcurrentIndices"` PatchAliasMaxIndices int `json:"patchAliasMaxIndices"` AdvancedSettings types.IndexSettings `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 IndexIntervalType ¶ added in v5.1.2
type IndexIntervalType string
IndexIntervalType represents the index interval options for time-based
const ( Daily IndexIntervalType = "daily" Monthly IndexIntervalType = "monthly" )
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
type RollmodeSettings ¶ added in v5.1.2
type RollmodeSettings struct { Type RollmodeType `json:"type"` Timebased *TimebasedSettings `json:"timebased,omitempty"` }
RollmodeSettings represents either a simple string for "cron" or a configuration for "timebased".
type RollmodeType ¶ added in v5.1.2
type RollmodeType string
RollmodeType represents the possible types of Rollmode
const ( RollmodeCron RollmodeType = "cron" RollmodeTimeBased RollmodeType = "timebased" )
type TimebasedSettings ¶ added in v5.1.2
type TimebasedSettings struct {
Interval IndexIntervalType `json:"interval"`
}
TimebasedSettings contains the specific settings for "timebased"