Skip to content

Commit

Permalink
housekeeping, added model alias_of field
Browse files Browse the repository at this point in the history
  • Loading branch information
cjimti committed Aug 1, 2019
1 parent da97d16 commit 0d04128
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 24 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
github.com/stretchr/objx v0.2.0 // indirect
github.com/txn2/ack v1.8.3
github.com/txn2/es v1.3.5
github.com/txn2/es/v2 v2.0.1
github.com/txn2/es/v2 v2.0.2
github.com/txn2/micro v0.0.6
github.com/txn2/provision v0.1.6
go.uber.org/zap v1.10.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ github.com/txn2/es v1.3.5 h1:BLlRQ4DnhwjEKYHoI+xsvaSV4En+h/gzA+knWgYi7Og=
github.com/txn2/es v1.3.5/go.mod h1:EpfYehD9ztuADfvJo9Eoiv43yampBl/F5MaNNb6C7WU=
github.com/txn2/es/v2 v2.0.1 h1:d44lU5xDoQHfQ50LAG0jOlC1lu8xbF7Ku1shhIjNlI0=
github.com/txn2/es/v2 v2.0.1/go.mod h1:EzHNcSmvgxzM84uNdFX8tPQ0JnvCfGm1CegWi4I0roI=
github.com/txn2/es/v2 v2.0.2 h1:KzCqY06mzIpKkZb8YuMpj03zVYYrN0DjFlLCiNnGYdM=
github.com/txn2/es/v2 v2.0.2/go.mod h1:EzHNcSmvgxzM84uNdFX8tPQ0JnvCfGm1CegWi4I0roI=
github.com/txn2/micro v0.0.5 h1:w6TcgFnYfbBW2r+FUM7MIUTN4q7+y/GvGqewquTt9tk=
github.com/txn2/micro v0.0.5/go.mod h1:r/uIbdFhvfjqKcT8mQUIKmzuh2Rxcablu7KB8oRRBoo=
github.com/txn2/micro v0.0.6 h1:VbN+fCcmRcagVhXYSlUCYgftkTTb5AZO1IltIJ/ZNfA=
Expand Down
19 changes: 7 additions & 12 deletions model.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
// 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.

package tm

import (
Expand All @@ -24,6 +13,9 @@ type Model struct {
// MachineName is a lowercase under score delimited uniq id
MachineName string `json:"machine_name" mapstructure:"machine_name"`

// AliasOf is the machine name of a model this model is an alias of.
AliasOf string `json:"alias_of" mapstructure:"alias_of"`

// short human readable display name
DisplayName string `json:"display_name" mapstructure:"display_name"`

Expand Down Expand Up @@ -147,7 +139,10 @@ func MakeModelTemplateMapping(account string, model *Model) es.IndexTemplate {
func GetModelsTemplateMapping() es.IndexTemplate {
properties := es.Obj{
"machine_name": es.Obj{
"type": "text",
"type": "keyword",
},
"alias_of": es.Obj{
"type": "keyword",
},
"display_name": es.Obj{
"type": "text",
Expand Down
11 changes: 0 additions & 11 deletions tm.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
// 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.

// Package tm implements Type Models for txn2 projects.
package tm

Expand Down

0 comments on commit 0d04128

Please sign in to comment.