util

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2019 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCardinalityMany = errors.New("Form data contained multiple input values for a single column")
	ErrUnexpectedJSON  = errors.New("Received JSON data that we are unable to parse")
)

Functions

func AppendNoDuplicates

func AppendNoDuplicates(list []map[string]interface{}, item map[string]interface{}) []map[string]interface{}

func ContextWithRelationships

func ContextWithRelationships(ctx context.Context, typeDescriptors []*descriptor.TypeDescriptor, table string) context.Context

ContextWithRelationships will return a new context which will included an array of all relationships for the table provided in the function's second parameter

func GetColumnNameAndTypeFromQueryParameterName

func GetColumnNameAndTypeFromQueryParameterName(typeDescriptors []*descriptor.TypeDescriptor, tableName string, paramName string) (columnName, columnType string, ok bool)

func GetDBTableNameUsingTypeDescriptorKey

func GetDBTableNameUsingTypeDescriptorKey(typeDescriptors []*descriptor.TypeDescriptor, typeDescriptorKey string) (tableName string, ok bool)

GetDBTableNameUsingTypeDescriptorKey will return the typeDescriptor from the descriptor.json file defined for the table provided in the function's second parameter

func GetTypeDescriptorUsingDBTableName

func GetTypeDescriptorUsingDBTableName(typeDescriptors []*descriptor.TypeDescriptor, tableName string) (td *descriptor.TypeDescriptor)

GetTypeDescriptorUsingDBTableName will return the typeDescriptor from the descriptor.json file defined for the table provided in the function's second parameter

func GetTypeDescriptorUsingTypeDescriptorKey

func GetTypeDescriptorUsingTypeDescriptorKey(typeDescriptors []*descriptor.TypeDescriptor, typeDescriptorKey string) (result *descriptor.TypeDescriptor)

func IsOptionRoute

func IsOptionRoute(req *http.Request) bool

func IsOptionsRoute

func IsOptionsRoute(req *http.Request) bool

func ParseDataForm

func ParseDataForm(req *http.Request) (data map[string]interface{}, err error)

func TableHasRelationships

func TableHasRelationships(cfg config.Config, table string) bool

func TypeDescriptorRelationships

func TypeDescriptorRelationships(td *descriptor.TypeDescriptor) []*descriptor.Field

Types

type ContextKey

type ContextKey string

ContextKey is used as a key when populating a context.Context with values

type NullTime

type NullTime struct {
	Time  time.Time
	Valid bool // Valid is true if Time is not NULL
}

func (*NullTime) Scan

func (nt *NullTime) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullTime) Value

func (nt NullTime) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type ResponseMessage

type ResponseMessage struct {
	Code int
	Tx   string
	Msg  string
}

func (*ResponseMessage) Byte

func (rm *ResponseMessage) Byte() []byte

func (*ResponseMessage) Error

func (rm *ResponseMessage) Error() string

func (*ResponseMessage) String

func (rm *ResponseMessage) String() string

Jump to

Keyboard shortcuts

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