ds

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package ds (Data Structure) contains all golang data structures used by generator.

Package ds (Data Structure) contains all golang data structures used by generator.

Package ds (Data Structure) contains all golang data structures used by generator.

Package ds (Data Structure) contains all golang data structures used by generator.

Package ds (Data Structure) contains all golang data structures used by generator.

Package ds (Data Structure) contains all golang data structures used by generator.

Package ds (Data Structure) contains all golang data structures used by generator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Const

type Const struct {
	Name string
	Val  interface{}
}

Const represents simplified constant in Golang AST. Name is the name of the constant. Val is an interface{} and represents any possible value of the struct.

func (Const) IsString

func (c Const) IsString() bool

IsString returns true if passed interface{} is a string.

type Enum

type Enum struct {
	Name   string
	Fields []string
}

Enum represents simplified Enum in Golang AST. Name is the name of the enum. Fields is a slice of string and represents all possible values of the enum.

type Func

type Func struct {
	Name         string
	Args         []TypeArg
	Type         string
	WrapperTypes []TypeField
}

Func represents simplified Function in Golang AST. Name is the name of the Function. Args is a slice of TypeArg and represents function parameters. Type is a string and represents return type of the function - i.e. "string", "Address" etc. WrapperTypes is a slice of TypeArg and represents selection set in GraphQL operation. It is used to create wrapper struct containing all values in selection set.

func (Func) ExportName

func (f Func) ExportName() string

ExportName converts name of the function to Title case.

func (Func) JoinArgsBy

func (f Func) JoinArgsBy(s string) string

JoinArgsBy returns list of function arguments as concatenated string with name and type.

type Struct

type Struct struct {
	Name   string
	Fields []TypeField
}

Struct represents simplified Struct in Golang AST. Name is the name of the struct. Fields is a slice of TypeArg and represents struct fields.

type TypeArg

type TypeArg struct {
	Name string
	Type string
}

TypeArg represents simplified argument in Golang AST. Name is the name of the argument. Type is type of the argument defined as string - i.e. "string", "int", "Address" etc.

func (TypeArg) ExportName

func (t TypeArg) ExportName() string

ExportName converts function argument name to TitleCase.

func (TypeArg) ExportType

func (t TypeArg) ExportType() TypeArg

ExportType converts function argument type to TitleCase excluding golang primitive types.

type TypeField

type TypeField struct {
	Name     string
	Type     string
	JsonName string
}

TypeField represents simplified struct field in Golang AST. Name is the name of the field. Type is type of the field defined as string - i.e. "string", "int", "Address" etc. JsonName is the name of the field used in `json:` tag.

func (TypeField) ExportName

func (t TypeField) ExportName() string

ExportName converts field name to TitleCase.

func (TypeField) ExportType

func (t TypeField) ExportType() TypeField

ExportType converts field name to TitleCase excluding golang primitive types.

func (TypeField) PointerType

func (t TypeField) PointerType() TypeField

PointerType converts TypeField to pointer type, excluding arrays/slices/maps.

Jump to

Keyboard shortcuts

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