github.com/wawandco/oxplugins@v0.7.11/tools/buffalo/model/templates.go (about)

     1  package model
     2  
     3  var modelTemplate string = `package models
     4  
     5  import (
     6  	{{- range $i := .Imports }}
     7  	"{{$i}}"
     8  	{{- end }}
     9  )
    10  
    11  // {{ .Name.Proper.String }} model struct
    12  type {{ .Name.Proper.String }} struct {
    13  	{{- range $attr := .Attrs }}
    14  	{{ $attr.Name.Pascalize }}	{{$attr.GoType }} ` + "`" + `json:"{{ $attr.Name.Underscore }}" db:"{{ $attr.Name.Underscore }}"` + "`" + `
    15  	{{- end }}
    16  }
    17  
    18  // {{ .Name.Proper.Pluralize }} array model struct of {{ .Name.Proper.String }}
    19  type {{ .Name.Proper.Pluralize }} []{{ .Name.Proper.String }}
    20  
    21  // String converts the struct into a string value
    22  func ({{ .Char }} {{ .Name.Proper.String }}) String() string {
    23  	return fmt.Sprintf("%+v\n", {{ .Char }})
    24  }
    25  `
    26  
    27  var modelTestTemplate string = `package models
    28  
    29  func (ms *ModelSuite) Test_{{ .Name.Proper.String }}() {
    30  	ms.Fail("This test needs to be implemented!")
    31  }`