types

package
v0.0.0-...-54a7264 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2020 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeleteQuery

type DeleteQuery struct {
	// ID  int   `form:"id"` TODO: https://github.com/gin-gonic/gin/pull/1061
	IDs []int `form:"ids"`
}

type IntSlice

type IntSlice []int

IntSlice - a postgres compatible int slice type

func (*IntSlice) Scan

func (s *IntSlice) Scan(src interface{}) error

sourced from https://gist.github.com/adharris/4163702

func (IntSlice) Value

func (s IntSlice) Value() (driver.Value, error)

Value returns the driver compatible value

type JSONBMap

type JSONBMap map[string]interface{}

TODO: consider using pgx intSlice TODO[ak|06/2018]: Scan() and Value() should work as is TODO[ak|06/2018]: I'm not sure about the text/binary related functions they are similar to pgtype.JSON and pgtype.JSONB Sourced from pgtype.JSON and pgype.JSONB

func (*JSONBMap) DecodeText

func (dst *JSONBMap) DecodeText(ci *pgtype.ConnInfo, src []byte) error

func (*JSONBMap) Scan

func (dst *JSONBMap) Scan(src interface{}) error

Scan implements the database/sql Scanner interface.

func (JSONBMap) Value

func (src JSONBMap) Value() (driver.Value, error)

Value implements the database/sql/driver Valuer interface.

type ListRequest

type ListRequest struct {
	Limit  int                    `json:"limit,omitempty" form:"limit,default=20" binding:"min=1,max=10000"`
	Offset int                    `json:"offset,omitempty" form:"offset,default=0" binding:"min=0"`
	Sort   []string               `json:"sort,omitempty" form:"sort" binding:""`
	Filter map[string]interface{} `json:"filter,omitempty" form:"filter"`
}

type PagedResult

type PagedResult struct {
	Records []interface{} `json:"records"`
	Page    PagingInfo    `json:"pagingInfo"`
}

PagedResult - this is the model for all the list endpoints, each endpoint however has its own type that has typed records

type PagingInfo

type PagingInfo struct {
	Offset       int                    `json:"offset,omitempty" example:"1"`
	Limit        int                    `json:"limit,omitempty" example:"1000"`        // the page size
	TotalRecords int                    `json:"totalRecords,omitempty" example:"6530"` // the total amount of records
	Sort         []string               `json:"sort,omitempty" example:"id"`
	Filter       map[string]interface{} `json:"filter,omitempty"`
}

PagingInfo - this is used to describe the page in a list

func GetPageInfo

func GetPageInfo(offset, limit, total int, sort []string, filter map[string]interface{}) PagingInfo

type StringSlice

type StringSlice []string

StringSlice - a postgres compatible string slice type

func (*StringSlice) Scan

func (s *StringSlice) Scan(src interface{}) error

sourced from https://gist.github.com/adharris/4163702

func (StringSlice) Value

func (s StringSlice) Value() (driver.Value, error)

Value returns the driver compatible value

type WebError

type WebError struct {
	Status     int      `json:"status,omitempty" example:"500"`                                      // status code
	IncidentID string   `json:"incidentId,omitempty" example:"89ed56f9-1935-4e13-9b3c-c208df64b484"` // trace reference id
	Message    string   `json:"message,omitempty" example:"Internal error"`                          // same as http status message
	Errors     []string `json:"errors,omitempty" example:""`                                         // list of actual errors "Field missing required length .. "
	MoreInfo   string   `json:"moreInfo,omitempty" example:""`                                       // link to documentation if any
}

WebError - This is a common error type used to standardize all api errors

Jump to

Keyboard shortcuts

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