core

package
v0.0.0-...-98c8ee3 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2019 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Index fieldIndex = func(names ...string) modelIndex {
	return modelIndex{names: names}
}
View Source
var Null fieldNull
View Source
var PrimaryKey fieldPrimaryKey = func(names ...string) modelPrimaryKey {
	return modelPrimaryKey{names: names}
}
View Source
var Unique fieldUnique = func(names ...string) modelUnique {
	return modelUnique{names: names}
}

Functions

func Array

func Array(element string) array

func Enum

func Enum(choices ...string) enum

func Field

func Field(name string, typeName string, flags ...FieldItem) field

func ForeignKey

func ForeignKey(foreignModelName string) fieldForeignKey

func Model

func Model(name string, items ...ModelItem) model

func ModelForeignKey

func ModelForeignKey(foreignModelName string, columnNames ...string) modelForeignKey

func Run

func Run(items ...gen.ConfigItem)

func Struct

func Struct(items ...ModelItem) structType

func Tag

func Tag(key string, value string) fieldTag

func Type

func Type(name string, t TypeDef) typeEntry

Types

type BaseType

type BaseType struct {
	Go       string
	GoNull   string
	Postgres SQLType
}

func (BaseType) GetType

func (t BaseType) GetType(name string) schema.Type

func (BaseType) ResolveTypes

func (t BaseType) ResolveTypes(v *Validation, st schema.Type, resolve func(name string, context string) schema.Type)

type FieldItem

type FieldItem interface {
	// contains filtered or unexported methods
}

type ModelItem

type ModelItem interface {
	// contains filtered or unexported methods
}

type Plugin

type Plugin struct {
	ModelTemplates     *gen.TemplateList
	StructTemplates    *gen.TemplateList
	EnumTemplates      *gen.TemplateList
	SingletonTemplates *gen.TemplateList
}

func (*Plugin) BunnyPlugin

func (p *Plugin) BunnyPlugin()

func (*Plugin) IsConfigItem

func (*Plugin) IsConfigItem()

type SQLType

type SQLType struct {
	Type      string
	ZeroValue string
}

type TxtToMany

type TxtToMany struct {
	LocalModel struct {
		NameGo       string
		ColumnNameGo string
	}

	ForeignModel struct {
		NameGo            string
		NamePluralGo      string
		NameHumanReadable string
		ColumnNameGo      string
		Slice             string
	}

	Function struct {
		Name          string
		ForeignName   string
		NameGo        string
		ForeignNameGo string

		UsesBytes bool

		LocalAssignment   string
		ForeignAssignment string
	}
}

TxtToMany contains text that will be used by many-to-one relationships.

type TxtToOne

type TxtToOne struct {
	ForeignKey *schema.ForeignKey

	LocalModel struct {
		NameGo       string
		ColumnNameGo string
	}

	ForeignModel struct {
		NameGo       string
		NamePluralGo string
		ColumnNameGo string
		ColumnName   string
	}

	Function struct {
		Name          string
		ForeignName   string
		NameGo        string
		ForeignNameGo string

		UsesBytes bool

		LocalAssignment   string
		ForeignAssignment string
	}
}

TxtToOne contains text that will be used by templates for a one-to-many or a one-to-one relationship.

type TypeDef

type TypeDef interface {
	GetType(name string) schema.Type
	ResolveTypes(v *Validation, t schema.Type, resolve func(name string, context string) schema.Type)
}

type Validation

type Validation struct {
	// contains filtered or unexported fields
}

func (*Validation) AddError

func (v *Validation) AddError(message string, args ...interface{})

Jump to

Keyboard shortcuts

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