Documentation ¶
Index ¶
Constants ¶
const ( // String defines the string type String = "string" // Int defines the int type supported, here the system uses int32 internally // as google v8 engine and graphql supports only int32 Int = "int" // Float defines the float type Float = "float" // ID defines the ID type, the sustem uses string version of uuid ID = "id" // Time defines timestamp type, internally uses time.Time Time = "time" // Bool defines boolean type Bool = "bool" // Object defines object type schema for composite types Object = "object" // List defines list type schema for composite types List = "list" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Definition ¶
type Definition struct { Modules []Module `json:"modules"` Repo string `json:"repo"` Queries []*Type `json:"high_level_queries"` Defaults *Defaults `json:"defaults"` }
Definition encapsulates the input schema definiton
func NewDefinition ¶
func NewDefinition() *Definition
NewDefinition return an instance of Definition
func (*Definition) ParseFrom ¶
func (d *Definition) ParseFrom(reader io.Reader) (*Definition, error)
ParseFrom parses the definitions from the given reader returns an instance of the same object and error if any. the duplicate return of object helps in chaining the functions like NewDefinition().ParseFrom()
func (*Definition) Validate ¶
func (d *Definition) Validate() error
type Meta ¶
type Meta struct { SearchFields []string `json:"search_fields"` Filters []string `json:"filters"` GraphqlOps Ops `json:"graphql_ops"` MutatableFields []string `json:"mutatable_fields"` SortBy []string `json:"sort_by"` ViewerRefenceField string `json:"viewer_reference_field"` }
Meta defines the data schema meta data properties
type Module ¶
type Module struct { Name string `json:"name"` DataSource string `json:"data_source"` DB string `json:"db"` Entities map[string]*Type `json:"entities"` }
Module encapsulates the module meta data
type Ops ¶
type Ops struct {
// contains filtered or unexported fields
}
Ops defines the supported graphql CRUD operations
func (*Ops) UnmarshalJSON ¶
UnmarshalJSON is a custom json unmarshaller the operations value will be given as a string `CRUD` for eg: to support only Create and Read ops, it will be `CR` this custom unmarshaller will parse the string and construct the Ops object
type Type ¶
type Type struct {
// contains filtered or unexported fields
}
Type encapsulates the type definition meta data
func (*Type) IsPrimitive ¶
IsPrimitive says the type is primitive or not
func (*Type) UnmarshalJSON ¶
UnmarshalJSON is a custom json unmarshaller type can be either a sting or an object in a given format eg: "int" or {type: "int", meta: {}}