transport

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// SignIn signs the client into a user
	SignIn(email, password string) (*gqlmod.Session, error)

	// SignInDebug signs the client into a debug user
	SignInDebug(username, password string) error

	// Auth authenticates the client by a user session key
	Auth(sessionKey string) (*gqlmod.Session, error)

	// Query performs an API query
	Query(query string, result interface{}) error

	// QueryVar performs a parameterized API query
	QueryVar(
		query string,
		vars map[string]interface{},
		result interface{},
	) error
}

Client defines the interface of the transport layer implementation. Run and Init are not intended to be thread-safe and shall only be used by a single goroutine!

type OnAuth

type OnAuth func(ctx context.Context, sessionKey string) (store.ID, time.Time)

OnAuth defines the client authentication callback function

type OnDebugAuth

type OnDebugAuth func(ctx context.Context, sessionKey string) bool

OnDebugAuth defines the debug authentication callback function

type OnDebugSess

type OnDebugSess func(ctx context.Context, username, password string) []byte

OnDebugSess defines the debug session creation callback function

type OnGraphQuery

type OnGraphQuery func(context.Context, graph.Query) (graph.Response, error)

OnGraphQuery defines the graph query callback function

type Server

type Server interface {
	// Init initializes the server transport implementation.
	// The provided callbacks must be registered and invoked accordingly
	Init(
		onGraphQuery OnGraphQuery,
		onAuth OnAuth,
		onDebugAuth OnDebugAuth,
		onDebugSess OnDebugSess,
		debugLog *log.Logger,
		errorLog *log.Logger,
	) error

	// Run starts serving. Blocks until the underlying server is shut down
	Run() error

	// Shutdown instructs the underlying server to shut down and blocks until
	// it is
	Shutdown(ctx context.Context) error
}

Server defines the interface of the server transport layer implementation. Run and Init are not intended to be thread-safe and shall only be used by a single goroutine!

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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