models

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AcceptLanguageHeaderError          = "ErrorAcceptLanguageHeader"
	AreaDataIdGetError                 = "ErrorRetrievingAreaCode"
	AreaDataIdUpsertError              = "AreaDataIdUpsertError"
	AncestryDataGetError               = "ErrorRetrievingAncestryData"
	MarshallingAreaDataError           = "ErrorMarshallingAreaData"
	MarshallingAreaRelationshipsError  = "ErrorMarshallingAreaRelationshipData"
	InvalidAreaCodeError               = "InvalidAreaCode"
	AreaNameNotProvidedError           = "AreaNameNotProvidedError"
	InvalidAreaTypeError               = "InvalidAreaType"
	AreaNameActiveFromNotProvidedError = "AreaNameActiveFromNotProvidedError"
	AreaNameActiveToNotProvidedError   = "AreaNameActiveToNotProvidedError"
	AreaNameDetailsNotProvidedError    = "AreaNameDetailsNotProvidedError"
	BodyCloseError                     = "BodyCloseError"
	BodyReadError                      = "RequestBodyReadError"
	JSONUnmarshalError                 = "JSONUnmarshalError"
)

API error codes

View Source
const (
	AcceptLanguageHeaderNotFoundDescription       = "accept language header not found"
	AcceptLanguageHeaderInvalidDescription        = "accept language header invalid"
	AreaDataGetErrorDescription                   = "area code not found"
	BodyClosedFailedDescription                   = "the request body failed to close"
	BodyReadFailedDescription                     = "endpoint returned an error reading the request body"
	ErrorUnmarshalFailedDescription               = "failed to unmarshal the request body"
	InvalidAreaCodeErrorDescription               = "the area code could not be validated"
	AreaNameDetailsNotProvidedErrorDescription    = "required field area_name not provided"
	AreaNameNotProvidedErrorDescription           = "required field area_name.name not provided"
	AreaNameActiveFromNotProvidedErrorDescription = "required field area_name.active_from not provided"
	AreaNameActiveToNotProvidedErrorDescription   = "required field area_name.active_to not provided"
	InvalidAreaTypeErrorDescription               = "failed to derive area type from area code"
)

API error descriptions

Variables

View Source
var (
	AcceptLanguageHeaderName = "Accept-Language"
	AcceptLanguageMapping    = map[string]string{
		"en": "English",
		"cy": "Cymraeg",
	}
)
View Source
var (
	CreateTableQuery = "CREATE TABLE IF NOT EXISTS %s (PRIMARY KEY (%s), %s)"
)

Functions

func BuildDescibeDBInstancesRequest added in v0.8.0

func BuildDescibeDBInstancesRequest(instanceName *string) *rds.DescribeDBInstancesInput

BuildDescibeDBInstancesRequest builds a correctly populated DescribeDBInstancesInput object using the required db instance name

Types

type AreaBasicData added in v0.10.0

type AreaBasicData struct {
	Code string `json:"code"`
	Name string `json:"name"`
}

AreaRelationShips represents the related areas with self ref

type AreaName added in v0.11.0

type AreaName struct {
	Name       string     `json:"name"`
	ActiveFrom *time.Time `json:"active_from"`
	ActiveTo   *time.Time `json:"active_to"`
}

AreaName represents the structure of the area name details used for update request

type AreaParams added in v0.11.0

type AreaParams struct {
	Code          string     `json:"code"`
	AreaName      *AreaName  `json:"area_name"`
	GeometricData string     `json:"geometry"`
	ActiveFrom    *time.Time `json:"active_from"`
	ActiveTo      *time.Time `json:"active_to"`
	Visible       *bool      `json:"visible"`
	AreaType      string
	ParentCode    string  `json:"parent_code"`
	AreaHectares  float64 `json:"area_hectares"`
}

AreaParams represents the structure of the area used for create or update

func (*AreaParams) SetAreaType added in v0.11.0

func (a *AreaParams) SetAreaType(ctx context.Context)

func (*AreaParams) ValidateAreaRequest added in v0.11.0

func (a *AreaParams) ValidateAreaRequest(ctx context.Context) []error

type AreaRelationShips added in v0.7.0

type AreaRelationShips struct {
	AreaCode string `json:"area_code"`
	AreaName string `json:"area_name"`
	Href     string `json:"href"`
}

AreaRelationShips represents the related areas with self ref

type AreaSeeding added in v0.11.0

type AreaSeeding struct {
	Areas map[string]interface{}
}

Struct for seeding area table with test data

type AreaType

type AreaType int

AreaType defines possible area types

type AreaTypeSeeding added in v0.11.0

type AreaTypeSeeding struct {
	AreaTypes map[string]map[string]interface{}
}

Struct for seeding area_type table with test data

type AreasAncestors added in v0.10.0

type AreasAncestors struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

AreasAncestors represents the Ancestry structure.

type AreasDataResults added in v0.6.0

type AreasDataResults struct {
	Code          string           `json:"code"`
	Name          *string          `json:"name"`
	GeometricData [][][2]float64   `json:"geometry"`
	Visible       *bool            `json:"visible"`
	AreaType      *string          `json:"area_type"`
	Ancestors     []AreasAncestors `json:"ancestors"`
}

AreasDataResults represents the structure for an area in api v1.

type DatabaseSchema added in v0.9.0

type DatabaseSchema struct {
	DBName,
	SchemaString string
	ExecutionList []string
	Tables        map[string]map[string]interface{}
}

DatabaseSchema database schema model

func (*DatabaseSchema) BuildDatabaseSchemaModel added in v0.9.0

func (db *DatabaseSchema) BuildDatabaseSchemaModel() error

BuildDatabaseSchemaModel build db schema model

func (*DatabaseSchema) TableSchemaBuilder added in v0.9.0

func (db *DatabaseSchema) TableSchemaBuilder()

TableSchemaBuilder builds table schema

type Error added in v0.6.0

type Error struct {
	Cause       error  `json:"-"`
	Code        string `json:"code"`
	Description string `json:"description"`
}

func NewError added in v0.6.0

func NewError(ctx context.Context, cause error, code string, description string) *Error

func NewValidationError added in v0.6.0

func NewValidationError(ctx context.Context, code string, description string) *Error

func (*Error) Error added in v0.6.0

func (e *Error) Error() string

type ErrorResponse added in v0.6.0

type ErrorResponse struct {
	Errors  []error           `json:"errors"`
	Status  int               `json:"-"`
	Headers map[string]string `json:"-"`
}

func NewBodyReadError added in v0.11.0

func NewBodyReadError(ctx context.Context, err error) *ErrorResponse

func NewBodyUnmarshalError added in v0.11.0

func NewBodyUnmarshalError(ctx context.Context, err error) *ErrorResponse

func NewDBReadError added in v0.11.0

func NewDBReadError(ctx context.Context, err error) *ErrorResponse

func NewErrorResponse added in v0.6.0

func NewErrorResponse(statusCode int, headers map[string]string, errors ...error) *ErrorResponse

type SuccessResponse added in v0.6.0

type SuccessResponse struct {
	Body    []byte            `json:"-"`
	Status  int               `json:"-"`
	Headers map[string]string `json:"-"`
}

func NewSuccessResponse added in v0.6.0

func NewSuccessResponse(jsonBody []byte, statusCode int, headers map[string]string) *SuccessResponse

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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