Skip to content

Commit

Permalink
new: use new regolithe api
Browse files Browse the repository at this point in the history
  • Loading branch information
primalmotion committed Sep 24, 2019
1 parent ec3c803 commit efe3956
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 20 deletions.
5 changes: 0 additions & 5 deletions attribute.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,6 @@ type AttributeSpecification struct {
// This is not enforced by elemental. You must write your own business logic to honor this.
CreationOnly bool

// DefaultOrder defines if the attribute is used as the default ordering key.
//
// This is not enforced by elemental. You must write your own business logic to honor this.
DefaultOrder bool

// DefaultValue holds the default value declared in specification.
DefaultValue interface{}

Expand Down
1 change: 0 additions & 1 deletion attribute_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ func TestAttribute_SpecificationForAttribute(t *testing.T) {
So(spec.Availability, ShouldBeEmpty)
So(spec.Channel, ShouldBeEmpty)
So(spec.CreationOnly, ShouldBeFalse)
So(spec.DefaultOrder, ShouldBeFalse)
So(spec.Deprecated, ShouldBeFalse)
So(spec.Exposed, ShouldBeTrue)
So(spec.Filterable, ShouldBeTrue)
Expand Down
4 changes: 2 additions & 2 deletions cmd/elegen/static/bindata.go

Large diffs are not rendered by default.

18 changes: 6 additions & 12 deletions cmd/elegen/templates/model.gotpl
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ func (o {{ .Spec.Model.EntityNamePlural }}List) List() elemental.IdentifiablesLi
func (o {{ .Spec.Model.EntityNamePlural }}List) DefaultOrder() []string {

return []string{
{{ range .Spec.OrderingAttributes $latestVersion -}}
"{{ .Name }}",
{{ range .Spec.DefaultOrder -}}
"{{ . }}",
{{ end }}
}
}
Expand Down Expand Up @@ -231,8 +231,8 @@ func (o *{{ .Spec.Model.EntityName }}) BleveType() string {
func (o *{{ .Spec.Model.EntityName }}) DefaultOrder() []string {

return []string{
{{ range .Spec.OrderingAttributes $latestVersion -}}
"{{ .Name }}",
{{ range .Spec.DefaultOrder -}}
"{{ . }}",
{{ end }}
}
}
Expand Down Expand Up @@ -587,9 +587,6 @@ var {{ .Spec.Model.EntityName }}AttributesMap = map[string]elemental.AttributeSp
{{- if .CreationOnly }}
CreationOnly: {{ .CreationOnly }},
{{- end }}
{{- if .DefaultOrder }}
DefaultOrder: {{ .DefaultOrder }},
{{- end }}
{{- if .DefaultValue }}
DefaultValue: {{ writeDefaultValue $.Set $.Spec . }},
{{- end }}
Expand Down Expand Up @@ -686,9 +683,6 @@ var {{ .Spec.Model.EntityName }}LowerCaseAttributesMap = map[string]elemental.At
{{- if .CreationOnly }}
CreationOnly: {{ .CreationOnly }},
{{- end }}
{{- if .DefaultOrder }}
DefaultOrder: {{ .DefaultOrder }},
{{- end }}
{{- if .DefaultValue }}
DefaultValue: {{ writeDefaultValue $.Set $.Spec . }},
{{- end }}
Expand Down Expand Up @@ -811,8 +805,8 @@ func (o Sparse{{ .Spec.Model.EntityNamePlural }}List) List() elemental.Identifia
func (o Sparse{{ .Spec.Model.EntityNamePlural }}List) DefaultOrder() []string {

return []string{
{{ range .Spec.OrderingAttributes $latestVersion -}}
"{{ .Name }}",
{{ range .Spec.DefaultOrder -}}
"{{ . }}",
{{ end }}
}
}
Expand Down

0 comments on commit efe3956

Please sign in to comment.