apiserver

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPort = "1988"

DefaultPort is the default port for the testing server

Variables

This section is empty.

Functions

func JSON

func JSON(w http.ResponseWriter, status int, data interface{})

JSON writes the given status code and data to the ResponseWriter.

func JSONError

func JSONError(w http.ResponseWriter, status int, err string)

JSONError writes the given status code and error message to the ResponseWriter.

func RunAPIServerContainer

func RunAPIServerContainer(ctx context.Context, port, label string, timeout time.Duration) error

RunAPIServerContainer runs a container with the apiserver image

Types

type CreateDBRequest

type CreateDBRequest struct {
	Type       string `json:"type"`
	Migrations string `json:"migrations"`
	Fixtures   string `json:"fixtures"`

	// postgres instance information
	InstanceHost string `json:"instance_host"`
	InstancePort uint32 `json:"instance_port"`
	InstanceUser string `json:"instance_user"`
	InstancePass string `json:"instance_pass"`
	InstanceName string `json:"instance_name"`
}

CreateDBRequest is the request body for creating a database

type CreateDBResponse

type CreateDBResponse struct {
	URI string `json:"uri"`
}

CreateDBResponse is the response body for creating a database

type RemoveDBRequest

type RemoveDBRequest struct {
	Type string `json:"type"`
	URI  string `json:"uri"`
}

RemoveDBRequest is the request body for removing a database

type Server

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

Server is the testing server

func NewServer

func NewServer(port string) *Server

NewServer creates a new testing server

func (*Server) CreateDB

func (s *Server) CreateDB(w http.ResponseWriter, r *http.Request)

CreateDB creates a new database

func (*Server) RemoveDB

func (s *Server) RemoveDB(w http.ResponseWriter, r *http.Request)

RemoveDB removes the given database

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Start starts the testing server

Jump to

Keyboard shortcuts

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