config

package
v0.0.0-...-f2905ed Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ID           = "id"
	One2One      = "one2one"
	One2Many     = "one2many"
	Many2Many    = "many2many"
	UniqueIndex  = "unique"
	PrimaryIndex = "primary"
	MultiIndex   = "index"

	Integer   = "integer"
	Float     = "float"
	String    = "string"
	Boolean   = "boolean"
	Timestamp = "timestamp"

	Link   = "link"
	Domain = "domain"

	Create = "create"
	Update = "update"
	Delete = "delete"
)

Variables

This section is empty.

Functions

func ParseIndex

func ParseIndex(index string) (string, string)

func Validate

func Validate(input string, valid ...string) string

Types

type Config

type Config struct {
	Generate []string `yaml:"generate"`
	Models   []Model  `yaml:"models"`
	Types    []Type   `yaml:"custom_types"`

	GraphQL   *GraphQLModule   `yaml:"graphql,omitempty"`
	Resolvers *ResolversModule `yaml:"resolvers,omitempty"`
	SQL       *SQLModule       `yaml:"sql,omitempty"`

	BaseImport string
}

func LoadConfig

func LoadConfig(r io.Reader) (*Config, error)

func LoadConfigAtPath

func LoadConfigAtPath(str string) (*Config, error)

func (Config) FindModelByName

func (t Config) FindModelByName(name string) *Model

func (Config) Primative

func (t Config) Primative(base string) (string, string)

type and import

func (Config) ShouldGenerate

func (t Config) ShouldGenerate(str string) bool

func (Config) String

func (t Config) String() string

type Field

type Field struct {
	Name         string        `yaml:"name"`
	Internal     string        `yaml:"internal,omitempty"`
	Description  string        `yaml:"description,omitempty"`
	Expose       *bool         `yaml:"expose,omitempty"`
	Type         string        `yaml:"type"`
	Indexes      []string      `yaml:"indexes,omitempty"`
	Deprecated   string        `yaml:"deprecated,omitempty"`
	Relationship *Relationship `yaml:"relationship,omitempty"`
}

type GraphQLModule

type GraphQLModule struct {
	Package string `yaml:"package"`
}

type Index

type Index struct {
	Name   string
	Type   string
	Fields []string
}

func (Index) NameWithIds

func (t Index) NameWithIds() string

type Model

type Model struct {
	Name        string     `yaml:"name"`
	Plural      string     `yaml:"plural"`
	Type        string     `yaml:"type"`
	Internal    string     `yaml:"internal,omitempty"`
	Description string     `yaml:"description,omitempty"`
	Fields      []Field    `yaml:"fields"`
	Deprecated  string     `yaml:"deprecated,omitempty"`
	Mutations   []Mutation `yaml:"mutations,omitempty"`
}

func (Model) FindFieldByInternal

func (t Model) FindFieldByInternal(internal string) Field

func (Model) FindFieldByName

func (t Model) FindFieldByName(name string) Field

func (Model) Indexes

func (t Model) Indexes() []Index

type Mutation

type Mutation struct {
	Name   string   `yaml:"name"`
	Type   string   `yaml:"type"`
	Fields []string `yaml:"fields"`
	Key    string   `yaml:"key"`
}

type Query

type Query struct {
	Name    string   `yaml:"name,omitempty"`
	Args    []string `yaml:"args,omitempty"`
	Returns string   `yaml:"returns,omitempty"`
}

type Relationship

type Relationship struct {
	To      string `yaml:"to,omitempty"`
	Through string `yaml:"through,omitempty"`
	Field   string `yaml:"field,omitempty"`
	Type    string `yaml:"type,omitempty"`
}

type ResolversModule

type ResolversModule struct {
	Package string `yaml:"package"`
}

type SQLModule

type SQLModule struct {
	Package string `yaml:"package"`
	Dialect string `yaml:"dialect"`
}

type Type

type Type struct {
	Name      string `yaml:"name"`
	Primative string `yaml:"primative"`
}

Jump to

Keyboard shortcuts

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