config

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: MIT Imports: 16 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	config.PackageConfig `yaml:",inline"`

	ExtraTypes []string `yaml:"extra_types,omitempty"`
	InputAsMap bool     `yaml:"input_as_map"`
}

type Config

type Config struct {
	SchemaFilename StringList      `yaml:"schema,omitempty"`
	Client         Client          `yaml:"client,omitempty"`
	Models         TypeMap         `yaml:"models,omitempty"`
	Endpoint       *EndPointConfig `yaml:"endpoint,omitempty"`
	Generate       *GenerateConfig `yaml:"generate,omitempty"`

	Query []string `yaml:"query"`

	// gqlgen config struct
	GQLConfig *config.Config `yaml:"-"`
}

Config extends the gqlgen basic config and represents the config file

func LoadConfig

func LoadConfig(filename string) (*Config, error)

LoadConfig loads and parses the config gqlgenc config

func LoadConfigFromDefaultLocations

func LoadConfigFromDefaultLocations() (*Config, error)

LoadConfigFromDefaultLocations looks for a config file in the current directory, and all parent directories walking up the tree. The closest config file will be returned.

func (*Config) LoadSchema

func (c *Config) LoadSchema(ctx context.Context) error

LoadSchema load and parses the schema from a local file or a remote server

type EndPointConfig

type EndPointConfig struct {
	URL     string            `yaml:"url"`
	Headers map[string]string `yaml:"headers,omitempty"`
}

EndPointConfig are the allowed options for the 'endpoint' config

type GenerateConfig

type GenerateConfig struct {
	Prefix *NamingConfig `yaml:"prefix,omitempty"`
	Suffix *NamingConfig `yaml:"suffix,omitempty"`
}

func (*GenerateConfig) ShouldGenerateClient

func (c *GenerateConfig) ShouldGenerateClient() bool

type NamingConfig

type NamingConfig struct {
	Query        string `yaml:"query,omitempty"`
	Mutation     string `yaml:"mutation,omitempty"`
	Subscription string `yaml:"subscription,omitempty"`
}

type StringList

type StringList []string

StringList is a simple array of strings

func (StringList) Has

func (a StringList) Has(file string) bool

Has checks if the strings array has a give value

type TypeMap

type TypeMap map[string]TypeMapEntry

type TypeMapEntry

type TypeMapEntry struct {
	config.TypeMapEntry `yaml:",inline"`

	AsMap bool `yaml:"as_map,omitempty"`
}

Jump to

Keyboard shortcuts

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