plugnplay

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2020 License: Unlicense Imports: 13 Imported by: 0

Documentation

Overview

Package plugnplay allows easy and combined configuration of the GraphQL + ORM stack with a lot of options

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Default connection string for connecting to the
	// database. This is used if the environment variable
	// DB_ADDR is not found.
	DefaultConnectionString string

	// Database system to use
	DBSystem dbsystem.DBSystem

	// Database user
	DBUser string

	// Database password
	DBPassword string

	// Database name
	DBName string

	// DBInsertOnMissingEntryToUpdate is used to determine
	// whether to insert when an object to be updated is not found.
	// This is useful when you want to use updates to both insert and
	// update depending on whether the entry exists or not
	DBInsertOnMissingEntryToUpdate bool

	// API handler configuration
	ApiHandlerConfig api.HandlerConfig

	// List of models to use for the database
	// and the GraphQL API.
	// You can either create a new instance of each
	// model and pass that instance or just cast (nil)
	// to a pointer of your model, e. g.:
	//
	//     Models: []interface{}{(*Customer)(nil), (*Product)(nil), (*Order)(nil)}
	//
	Models []interface{}

	// List of models to exclude from the use
	// in the GraphQL API. This might be useful in case
	// you have models that you only use on the server side
	// and don't want to be exposed via the API.
	ExcludeModelsFromGQL []interface{}

	// CustomGQLQueries allows you to add your own queries to the schema
	// or overwrite existing ones
	CustomGQLQueries graphql.Fields

	// CustomGQLMutations allows you to add your own mutations to the schema
	// or overwrite existing ones
	CustomGQLMutations graphql.Fields
}

type PluggedConfig

type PluggedConfig struct {
	Config                 *Config
	GraphQLSchema          *graphql.Schema
	GraphQLSchemaGenerator *generator.GraphQLSchemaGenerator
	Database               *database.Database
	// contains filtered or unexported fields
}

func Plug

func Plug(config *Config) *PluggedConfig

func (*PluggedConfig) Play

func (config *PluggedConfig) Play() error

Jump to

Keyboard shortcuts

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