schema

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Enum

type Enum struct {
	Name   string   `json:"name"`
	Values []string `json:"values"`
}

type EnumList

type EnumList []*Enum

func (EnumList) ForName

func (l EnumList) ForName(name string) *Enum

func (EnumList) IsEnum

func (l EnumList) IsEnum(v string) bool

type Field

type Field struct {
	Name       string
	ReturnType ReturnType
	Directive  *directive.Directive
}

func (Field) IsConnection

func (f Field) IsConnection() (*string, bool)

type FieldList

type FieldList []*Field

func (FieldList) ForName

func (l FieldList) ForName(name string) *Field

func (FieldList) HasConnection

func (l FieldList) HasConnection() bool

func (FieldList) Names

func (l FieldList) Names() []string

type Object

type Object struct {
	Name      string                  `json:"name"`
	AuthRules *directive.AuthRuleList `json:"-"`
	Fields    FieldList               `json:"-"`
	Type      ObjectType              `json:"type"`
}

func (Object) ConnectedNames

func (o Object) ConnectedNames() (string, string)

func (Object) HasAuthRule

func (o Object) HasAuthRule() bool

type ObjectList

type ObjectList []*Object

func (ObjectList) ForName

func (o ObjectList) ForName(name string) *Object

type ObjectType

type ObjectType struct {
	Name string
}

func NewObjectType

func NewObjectType(name string) ObjectType

func (ObjectType) IsConnection

func (o ObjectType) IsConnection() bool

func (ObjectType) IsConnectionPayload

func (o ObjectType) IsConnectionPayload() bool

func (ObjectType) IsPayload

func (o ObjectType) IsPayload() bool

type ReturnType

type ReturnType struct {
	*EnumList
	Name            string `json:"name"`
	IsArray         bool   `json:"isArray"`
	IsRequired      bool   `json:"-"`
	IsArrayRequired bool   `json:"-"`
}

func (ReturnType) IsPrimitive

func (r ReturnType) IsPrimitive() bool

type Schema

type Schema struct {
	Objects     ObjectList     `json:"-"`
	Enums       EnumList       `json:"-"`
	FilePath    string         `json:"file_path"`
	Connections utils.PairList `json:"-"`
	HasManyList utils.PairList `json:"-"`
}

func NewSchema

func NewSchema(importPath string) *Schema

func (*Schema) GenerateNewSchemaFile

func (s *Schema) GenerateNewSchemaFile(exportPath string, tmpl *template.Template)

Jump to

Keyboard shortcuts

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