github.com/go-generalize/volcago@v1.7.0/generator/template.go (about)

     1  package generator
     2  
     3  import (
     4  	"embed"
     5  )
     6  
     7  var (
     8  	//go:embed templates
     9  	templatesFS embed.FS
    10  )
    11  
    12  type IndexesInfo struct {
    13  	Comment   string
    14  	ConstName string
    15  	Label     string
    16  	Method    string
    17  	Use       bool
    18  }
    19  
    20  type FieldInfo struct {
    21  	FsTag          string
    22  	Field          string
    23  	FieldType      string
    24  	IsUnique       bool
    25  	IsDocumentID   bool
    26  	IndexerTag     string
    27  	Indexes        []*IndexesInfo
    28  	NullableFields []string
    29  }
    30  
    31  type UniqueInfo struct {
    32  	Field string
    33  	FsTag string
    34  }
    35  
    36  type templateParameter struct {
    37  	AppVersion        string
    38  	PackageName       string
    39  	CollectionName    string
    40  	ImportName        string
    41  	GeneratedFileName string
    42  	FileName          string
    43  	StructName        string
    44  	StructNameRef     string
    45  	ModelImportPath   string
    46  	MockGenPath       string
    47  	MockOutputPath    string
    48  
    49  	RepositoryStructName    string
    50  	RepositoryInterfaceName string
    51  
    52  	KeyFieldName string
    53  	KeyFieldType string
    54  	KeyValueName string // lower camel case
    55  
    56  	FieldInfos  []*FieldInfo
    57  	UniqueInfos []*UniqueInfo
    58  
    59  	EnableIndexes       bool
    60  	FieldInfoForIndexes *FieldInfo
    61  	BoolCriteriaCnt     int
    62  	SliceExist          bool
    63  
    64  	AutomaticGeneration bool
    65  	IsSubCollection     bool
    66  
    67  	MetaFieldsEnabled bool
    68  }