generate

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2022 License: GPL-3.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//go:embed templates/model.tmpl
	Modeltmpl []byte
	//go:embed templates/enum.tmpl
	Enumtmpl []byte
	//go:embed templates/union.tmpl
	Uniontmpl []byte
	//go:embed templates/scalar.tmpl
	Scalartmpl []byte
	//go:embed templates/objecttype_definition.tmpl
	Objecttypetmpl []byte
	//go:embed templates/queries.tmpl
	Queriestmpl []byte
	//go:embed templates/mutations.tmpl
	Mutationstmpl []byte
	//go:embed templates/subscriptions.tmpl
	Subscriptionstmpl []byte
	//go:embed templates/main.tmpl
	Maintmpl []byte
)
View Source
var IndexIDName = []string{
	"_id",
	"id",
}
View Source
var OmitObject = []string{
	"__Directive",
	"__EnumValue",
	"__Field",
	"__InputValue",
	"__Schema",
	"__Type",
	"__TypeKind",
	"__DirectiveLocation",
}
View Source
var OmitScalarTypes = []string{
	"Int",
	"Float",
	"String",
	"Boolean",
}

Functions

func GetNamedType

func GetNamedType(namedType string) (r string, isID bool)

Types

type AttrDef

type AttrDef struct {
	Name    string
	Type    string
	IsArray bool
	BSONTag string
	GQLTag  string
}

type EnumAttrDef

type EnumAttrDef struct {
	Name  string
	Value string
}

type EnumDef

type EnumDef struct {
	Name        string
	PackageName string
	Attr        []EnumAttrDef
	FilePath    string
}

type GqlGenerate

type GqlGenerate struct {
	SchemaPath     string
	ModuleName     string
	ModulePath     string
	ModelPath      string
	ResolverPath   string
	UnionPath      string
	ScalarPath     string
	EnumPath       string
	ObjecttypePath string
}

type ModelDef

type ModelDef struct {
	Name             string
	RealName         string
	PackageName      string
	Attr             []AttrDef
	IsUseID          bool
	IsUseUnion       bool
	IsUseScalar      bool
	IsUseEnum        bool
	FilePath         string
	ModelPath        string
	ScalarPath       string
	UnionPath        string
	EnumPath         string
	ObjectTypePath   string
	QueryPath        string
	MutationPath     string
	SubscriptionPath string
	GQLFile          string
}

type ObjectTypeDef

type ObjectTypeDef struct {
	Name                  string
	PackageName           string
	RealName              string
	ModelPath             string
	ModuleName            string
	DefinitionPath        string
	FilePath              string
	QueryPath             string
	MutationPath          string
	SubscriptionPath      string
	HasQueries            bool
	HasMutations          bool
	HasSubscriptions      bool
	QueryResolvers        []map[string]string
	MutationResolvers     []map[string]string
	SubscriptionResolvers []map[string]string
}

type RenderTypes

type RenderTypes struct {
	ModelType  []ModelDef
	ObjectType []ObjectTypeDef
	EnumType   []EnumDef
	UnionType  UnionDef
	ScalarType []ScalarDef
	IsScalar   bool
	ScalarPath string
	MainPath   string
}

type ScalarDef

type ScalarDef struct {
	Name        string
	VarName     string
	PackageName string
	TypeName    string
	FilePath    string
}

type UnionAttrDef

type UnionAttrDef struct {
	Name  string
	Types string
}

type UnionDef

type UnionDef struct {
	PackageName string
	Type        []UnionAttrDef
	FilePath    string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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