server

package
v0.10.25 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(c Config) (httpHandler http.Handler, err error)

New returns new handler for graphql server

func NewWebhookHandler added in v0.9.13

func NewWebhookHandler(c Config) (httpHandler http.Handler, err error)

NewWebhookHandler returns new handler for webhook to graphql server

Types

type Config

type Config struct {
	router.Config
	Pretty             *bool              `json:"pretty"`
	GraphiQL           *bool              `json:"graphiql"`
	DefaultEnvironment router.Environment `json:"defaultEnvironment"`
}

Config is a GraphQL http server configuration

func (*Config) UnmarshalJSON

func (c *Config) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json unmarshaler

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml unmarshaler

type Driver

type Driver struct {
	driver.Config
	Type       DriverKind             `json:"type"`
	Attributes map[string]interface{} `json:"-"`
	Optional   bool                   `json:"optional"`
	// contains filtered or unexported fields
}

Driver is a driver definition for server

func (*Driver) Close

func (d *Driver) Close() (err error)

Close implements io.Closer

func (*Driver) Load

func (d *Driver) Load() error

Load loads a known driver type with config

func (*Driver) UnmarshalJSON

func (d *Driver) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler

type DriverKind

type DriverKind uint8

DriverKind represents one of implemented drivers for handling functions

const (
	Unknown DriverKind = iota
	Plugin
	Azure
)

Enums representing supported drivers

func (DriverKind) MarshalJSON

func (d DriverKind) MarshalJSON() (b []byte, err error)

MarshalJSON implements json.Marshaler

func (*DriverKind) UnmarshalJSON

func (d *DriverKind) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON implements Unmarshaler

type Drivers

type Drivers []Driver

Drivers is a list of supported by router

func NewDefaultDrivers added in v0.9.8

func NewDefaultDrivers() Drivers

NewDefaultDrivers returns default drivers which include local and azure driver for localhost

func (*Drivers) Close

func (d *Drivers) Close() (err error)

Close implements io.Closer

func (*Drivers) Load

func (d *Drivers) Load() error

Load loads known drivers with their configuration

type DriversCloseError

type DriversCloseError []error

DriversCloseError is a list of errors

func (DriversCloseError) Error

func (d DriversCloseError) Error() string

type Server

type Server struct {
	Handler        http.Handler
	WebhookHandler http.Handler
	Health         http.Handler
	Addr           string
}

Server default simple server that has two endpoints. /graphql which uses Handler as a handler and /health that uses Health as a handler or just returns 200. It handles SIGTERM.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

ListenAndServe is a simple wrapper around http.Server.ListenAndServe with two endpoints. It is blocking

Jump to

Keyboard shortcuts

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