Documentation
¶
Index ¶
- Variables
- func Decode(ctx context.Context, d Decodable, input []byte) error
- func DecodeAndValidate(ctx context.Context, v DecodeValidate, input []byte) error
- func DecodeAndValidateReader(ctx context.Context, v DecodeValidate, input io.Reader) error
- func DecodeAndValidateString(ctx context.Context, v DecodeValidate, input string) error
- func DecodeJSON(ctx context.Context, input []byte, v interface{}) error
- func Validate(ctx context.Context, v Validatable) error
- type Decodable
- type DecodeValidate
- type ID
- type MerchantID
- type OrderDirection
- type PageOrder
- type Pagination
- type PublicKey
- type Validatable
Constants ¶
This section is empty.
Variables ¶
var ( // ErrIDDecodeNotUUID - an error that tells caller the id is not a uuid ErrIDDecodeNotUUID = errors.New("failed to decode id: id is not a uuid") // ErrIDDecodeEmpty - an error that tells caller the id is empty and should not be ErrIDDecodeEmpty = errors.New("failed to decode id: id cannot be empty") )
var ( // ErrPublicKeyDecodeEmpty - an error that tells caller the public key is empty and should not be ErrPublicKeyDecodeEmpty = errors.New("failed to decode public key: public key cannot be empty") )
Functions ¶
func DecodeAndValidate ¶
func DecodeAndValidate(ctx context.Context, v DecodeValidate, input []byte) error
DecodeAndValidate - perform decode and validate of input in one swipe
func DecodeAndValidateReader ¶
DecodeAndValidateReader - perform decode and validate of input in one swipe
func DecodeAndValidateString ¶
func DecodeAndValidateString(ctx context.Context, v DecodeValidate, input string) error
DecodeAndValidateString - perform decode and validate of input in one swipe of a string input
func DecodeJSON ¶
DecodeJSON - decode json helper
Types ¶
type DecodeValidate ¶
type DecodeValidate interface { Validatable Decodable }
DecodeValidate - decode and validate for inputs
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
ID - a generic ID type that can be used for common id based things
type MerchantID ¶
type MerchantID struct {
// contains filtered or unexported fields
}
MerchantID - identifier of a merchant
func NewMerchantID ¶
func NewMerchantID(ctx context.Context, v string) (*MerchantID, error)
NewMerchantID - create a new merchant id
func (*MerchantID) Decode ¶
func (m *MerchantID) Decode(ctx context.Context, v []byte) error
Decode - implementation of decodable interface
func (MerchantID) UUID ¶
func (m MerchantID) UUID() uuid.UUID
UUID - get the UUID representation of the merchant id
type OrderDirection ¶
type OrderDirection string
OrderDirection - the directionality type
const ( // Ascending - ASC Ascending OrderDirection = "ASC" // Descending - DESC Descending = "DESC" )
type PageOrder ¶
type PageOrder struct { Direction OrderDirection Attribute string }
PageOrder - this directionality and attribute used for ordering
type Pagination ¶
Pagination - parameters common to pagination page=1&items=50&order=id
func NewPagination ¶
func NewPagination(ctx context.Context, url string, v interface{}) (context.Context, *Pagination, error)
NewPagination - create a new Pagination struct and populate from url and order options
func (*Pagination) Decode ¶
func (p *Pagination) Decode(ctx context.Context, v []byte) error
Decode - implementation of decodable interface
func (Pagination) GetOrderBy ¶
func (p Pagination) GetOrderBy(ctx context.Context) string
GetOrderBy - create the order by expression and parameters for pagination
type PublicKey ¶
type PublicKey string
PublicKey - a generic ID type that can be used for common id based things
type Validatable ¶
Validatable - and interface that allows for validation of inputs and params