codegen

package
v0.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadModel

func LoadModel(
	pkg, strct string,
	strcts map[string]Strct,
)

Types

type Collection

type Collection struct {
	ModelType      string
	CollectionType string
	IDType         string
}

type Collections

type Collections struct {
	PackageName string
	Collections map[string]Collection
	Imports     []string
}

type Config

type Config struct {
	Output struct {
		Models      OutputConfig
		Collections OutputConfig
	}

	Primitives  []string
	Collections map[string]string
}

func DefaultConfig

func DefaultConfig() *Config

func (*Config) Generate

func (c *Config) Generate()

type Field

type Field struct {
	Name    string
	BsonKey string
	Type    string
	Imports map[string]struct{}
}

type Models

type Models struct {
	PackageName string
	Structs     []Strct
	Imports     []string
}

type OutputConfig

type OutputConfig struct {
	Package  string
	Filename string
}

type Strct

type Strct struct {
	Name            string
	Fields          []Field
	StructImport    string
	EmbeddedImports map[string]struct{}
	Skip            bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL