schema

package
Version: v0.0.0-...-b472bfd Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package schema provides schema support for the database.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoSchemaExists = errors.New("no schema exists")
	ErrInvalidSchema  = errors.New("schema doesn't match")
)

Schema error variables.

Functions

This section is empty.

Types

type Config

type Config struct {
	CustomFunctions
}

Config contains information required for the schema document.

type CustomFunctions

type CustomFunctions struct {
	UploadFeedURL string
}

CustomFunctions is the set of custom functions defined in the schema. The URL to the function is required as part of the function declaration.

type Schema

type Schema struct {
	// contains filtered or unexported fields
}

Schema provides support for schema operations against the database.

func New

func New(graphql *graphql.GraphQL, config Config) (*Schema, error)

New constructs a Schema value for use to manage the schema.

func (*Schema) Create

func (s *Schema) Create(ctx context.Context) error

Create is used create the schema in the database.

func (*Schema) DropAll

func (s *Schema) DropAll(ctx context.Context) error

DropAll perform an alter operatation against the configured server to remove all the data and schema.

func (*Schema) DropData

func (s *Schema) DropData(ctx context.Context) error

DropData perform an alter operatation against the configured server to remove all the data and schema.

type UploadFeedRequest

type UploadFeedRequest struct {
	CountryCode string  `json:"countrycode"`
	CityName    string  `json:"cityname"`
	Lat         float64 `json:"lat"`
	Lng         float64 `json:"lng"`
}

UploadFeedRequest is the data required to make a feed/upload request.

type UploadFeedResponse

type UploadFeedResponse struct {
	CountryCode string  `json:"country_code"`
	CityName    string  `json:"city_name"`
	Lat         float64 `json:"lat"`
	Lng         float64 `json:"lng"`
	Message     string  `json:"message"`
}

UploadFeedResponse is the response from the feed/upload request.

Jump to

Keyboard shortcuts

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