gorm

package
v0.0.0-...-3dff154 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2018 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts *Options) (*genny.Generator, error)

Types

type Attribute

type Attribute struct {
	Name         inflect.Name
	OriginalType string
	GoType       string
	FizzType     string
	Primary      bool
	Nullable     bool
}

func (Attribute) IsValidable

func (a Attribute) IsValidable() bool

func (Attribute) String

func (a Attribute) String() string

type Model

type Model struct {
	Package               string
	Imports               []string
	Name                  inflect.Name
	Attributes            []Attribute
	ValidatableAttributes []Attribute

	HasNulls  bool
	HasUUID   bool
	HasSlices bool
	HasID     bool
}

func NewModel

func NewModel(name string) Model

func (*Model) ParseAttributes

func (m *Model) ParseAttributes(attrs ...Prop)

type Options

type Options struct {
	App       meta.App     `json:"app"`
	Name      inflect.Name `json:"name"`
	ModelName inflect.Name `json:"model_name"`
	Model     Model        `json:"model"`
	Char      string       `json:"char"`
	// SkipMigration bool         `json:"skip_migration"`
	// SkipModel     bool         `json:"skip_model"`
	// SkipTemplates bool         `json:"skip_templates"`
	// UseModel      bool         `json:"use_model"`
	FilesPath   string           `json:"files_path"`
	ActionsPath string           `json:"actions_path"`
	Props       []Prop           `json:"props"`
	NamedAttrs  attrs.NamedAttrs `json:"named_attrs"`
	Actions     []string         `json:"actions"`
	Args        []string         `json:"args"`

	Init bool `json:"init"`
}

func (*Options) Validate

func (opts *Options) Validate() error

Validate that options are usuable

type Prop

type Prop struct {
	Name     inflect.Name
	Type     string
	Nullable bool
}

Prop of a model. Starts as name:type on the command line.

func (Prop) String

func (m Prop) String() string

String representation of Prop

Jump to

Keyboard shortcuts

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