serializer

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2019 License: GPL-3.0 Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column added in v0.0.3

type Column struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

Column describes a table column in DB

type HTTPError

type HTTPError interface {
	error
	StatusCode() int
}

HTTPError defines an Error message as it will be written in the http.Response

func NewHTTPError

func NewHTTPError(statusCode int, msg ...string) HTTPError

NewHTTPError returns an Error

func NewMySQLError

func NewMySQLError(statusCode int, mysqlCode uint16, msg ...string) HTTPError

NewMySQLError returns an Error with the MySQL error code

type Response

type Response struct {
	Status int         `json:"status"`
	Data   interface{} `json:"data,omitempty"`
	Meta   interface{} `json:"meta,omitempty"`
	Errors []HTTPError `json:"errors,omitempty"`
}

Response encapsulate the content of an http.Response

func NewDetectLangResponse added in v0.0.7

func NewDetectLangResponse(lang string, langType enry.Type) *Response

NewDetectLangResponse returns a Response with detected language

func NewEmptyResponse

func NewEmptyResponse() *Response

NewEmptyResponse returns an empty Response

func NewLanguagesResponse added in v0.0.7

func NewLanguagesResponse(langs []service.Language) *Response

NewLanguagesResponse returns Response with a list of languages

func NewParseResponse added in v0.0.3

func NewParseResponse(resp *service.ParseResponse) *Response

NewParseResponse returns a Response with UAST

func NewQueryResponse

func NewQueryResponse(
	rows []map[string]interface{},
	columnNames,
	columnTypes []string,
	limitSet bool,
	limit int,
) *Response

NewQueryResponse returns a Response with table headers and row contents

func NewSchemaResponse added in v0.0.3

func NewSchemaResponse(tables map[string][]Column) *Response

NewSchemaResponse returns a Response with tables schema

func NewVersionResponse

func NewVersionResponse(version, bblfshVersion, gitbaseVersion string) *Response

NewVersionResponse returns a Response with current version of the server

func UASTFilterResponse added in v0.0.9

func UASTFilterResponse(resp nodes.Array) *Response

UASTFilterResponse return a Response with UAST search results

type Table added in v0.0.3

type Table struct {
	Table   string   `json:"table"`
	Columns []Column `json:"columns"`
}

Table struct describes a schema of one table in DB

Jump to

Keyboard shortcuts

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