Documentation
¶
Index ¶
- Variables
- type Caster
- type Error
- func (e *Error) BodyLength() int
- func (e *Error) Err() error
- func (e *Error) Error() string
- func (e *Error) ErrorCode(code string) *Error
- func (e *Error) Format(msg string, args ...interface{}) *Error
- func (e *Error) FormatFunc(msg string) func(args ...interface{}) *Error
- func (e *Error) Header() http.Header
- func (e *Error) Reason(args ...interface{}) *Error
- func (e *Error) Scan(src interface{}) error
- func (e *Error) Status(status int) *Error
- func (e *Error) StatusCode() int
- func (e *Error) String() string
- func (*Error) Validate(formats strfmt.Registry) error
- func (e Error) Value() (driver.Value, error)
- func (e *Error) WriteResponse(rw http.ResponseWriter, pr runtime.Producer)
- type Link
- type MapFilter
- type Mapper
- type Model
- type Params
- type Profile
- func (m *Profile) MarshalBinary() ([]byte, error)
- func (m Profile) MarshalJSON() ([]byte, error)
- func (m *Profile) Scan(value interface{}) error
- func (m *Profile) UnmarshalBinary(b []byte) error
- func (m *Profile) UnmarshalJSON(raw []byte) error
- func (m *Profile) Validate(formats strfmt.Registry) error
- func (m *Profile) Value() (driver.Value, error)
- type Response
- func (r *Response) Body() []byte
- func (r *Response) Copy() *Response
- func (r *Response) Header() http.Header
- func (r *Response) Length() int
- func (r *Response) SetAcceleration(acc bool) *Response
- func (r *Response) SetHeader(name, value string) *Response
- func (r *Response) SetHeaderMap(vals map[string]string) *Response
- func (r *Response) SetHeaders(h http.Header) *Response
- func (r *Response) SetOptions(options ...*ResponseOptions) *Response
- func (r *Response) SetPayload(payload interface{}) *Response
- func (r *Response) SetStatus(s int) *Response
- func (r *Response) StatusCode() int
- func (r *Response) Write(body []byte) (int, error)
- func (r *Response) WriteHeader(statusCode int)
- func (r *Response) WriteResponse(rw http.ResponseWriter, pr runtime.Producer)
- type ResponseOptions
- type Slicer
- type StringArray
- type StringMap
- func (p StringMap) Bool(key string, def ...bool) bool
- func (p StringMap) Cast(key interface{}) Caster
- func (p StringMap) Copy() Mapper
- func (p StringMap) Delete(key interface{})
- func (p StringMap) Float64(key string, def ...float64) float64
- func (p StringMap) Get(key interface{}) interface{}
- func (p StringMap) GetValue(key string) (Value, bool)
- func (p StringMap) Int64(key string, def ...int64) int64
- func (p StringMap) IsSet(key interface{}) bool
- func (p *StringMap) Scan(src interface{}) error
- func (p StringMap) Set(key, value interface{})
- func (p StringMap) String(key string, def ...string) string
- func (p StringMap) StringPtr(key string, def ...string) *string
- func (p StringMap) StringSlice(key string) []string
- func (p StringMap) Sub(key interface{}) Mapper
- func (*StringMap) Validate(formats strfmt.Registry) error
- func (p StringMap) Value() (driver.Value, error)
- func (p StringMap) Without(keys ...interface{}) Mapper
- type Ticker
- type UUIDArray
- type Value
- func (v Value) Bool() bool
- func (v Value) Float64() float64
- func (v Value) Int64() int64
- func (v Value) Interface() interface{}
- func (v Value) IsNil() bool
- func (v Value) Slice() []interface{}
- func (v Value) String() string
- func (v Value) StringMap() StringMap
- func (v Value) StringPtr() *string
- func (v Value) StringSlice() []string
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotAuthorized defines a not authorized error ErrNotAuthorized = NewError().Status(http.StatusUnauthorized).Format("not authorized") // ErrInvalidParameter defines an invalid parameter error ErrInvalidParameter = NewError().Status(http.StatusBadRequest).Format("invalid parameter") // ErrNotImplemented defines a not implemented error ErrNotImplemented = NewError().Status(http.StatusNotImplemented).FormatFunc("method '%s' not implemented") // ErrResourceConflict is returned when an object conflicts with one that already exists ErrResourceConflict = NewError().Status(http.StatusConflict).FormatFunc("'%s' conflicts with one that already exists") // ErrNotFound is is returned when an object was not found ErrNotFound = NewError().Status(http.StatusNotFound).FormatFunc("'%s' not found") // ErrServerError is reserved for server errors ErrServerError = NewError().Status(http.StatusInternalServerError).FormatFunc("server error: %s") )
var ( // NoContentResponse is a no content HTTP success response NoContentResponse = NewResponse().SetStatus(http.StatusNoContent) // SeeOtherResponse returns a redirect response SeeOtherResponse = func(loc string) *Response { return NewResponse().SetStatus(http.StatusSeeOther).SetHeader("Location", loc) } )
var ( // DefaultProfile is a default profile object DefaultProfile = &Profile{ StandardClaims: openid.StandardClaims{ Locale: ptr.String("en-US"), }, } )
var ModelGenerateUUID = false
ModelGenerateUUID is a flag to tell sparks to generate a new uuid for the models
Functions ¶
This section is empty.
Types ¶
type Caster ¶ added in v1.1.3
type Caster interface {
String() string
StringPtr() *string
StringSlice() []string
Bool() bool
Int64() int64
Float64() float64
Slice() []interface{}
StringMap() StringMap
}
Caster defines a simple casting interface
type Error ¶
type Error struct {
Code *string `json:"code,omitempty"`
Message *string `json:"message,omitempty"`
Detail map[string]string `json:"detail,omitempty"`
// contains filtered or unexported fields
}
Error is the common error struct compatible with swagger response types
func (*Error) BodyLength ¶
BodyLength returns the http body length in bytes
func (*Error) FormatFunc ¶
FormatFunc func formats a error message functor
func (*Error) WriteResponse ¶
func (e *Error) WriteResponse(rw http.ResponseWriter, pr runtime.Producer)
WriteResponse implements the middleware.Responder interface
type Link ¶
type Link struct {
// expires at
ExpiresAt int64 `json:"expires_at,omitempty"`
// the target url/uri
// Format: uri
Href strfmt.URI `json:"href,omitempty"`
// optional link name
Name *string `json:"name,omitempty"`
}
Link an href link object swagger:model Link
func (*Link) MarshalBinary ¶
MarshalBinary interface implementation
func (*Link) UnmarshalBinary ¶
UnmarshalBinary interface implementation
type MapFilter ¶ added in v1.1.0
MapFilter returns true and the key and value, or false if the value should be skipped
type Mapper ¶ added in v1.1.0
type Mapper interface {
IsSet(key interface{}) bool
Set(key, value interface{})
Get(key interface{}) interface{}
Cast(key interface{}) Caster
Sub(key interface{}) Mapper
Delete(key interface{})
Copy() Mapper
Without(keys ...interface{}) Mapper
}
Mapper provides a map wrapper interface for working easily with unknown map types
type Model ¶
type Model struct {
// Table unique identifier
// Read Only: true
ID int64 `json:"id"`
// Universally unique identifier
// Read Only: true
UUID *strfmt.UUID `json:"uuid,omitempty"`
// Date and time of object creation
// Read Only: true
CreatedAt strfmt.DateTime `json:"created_at,omitempty" sql:"column:_created_at"`
// User uuid that created the object
// Read Only: true
CreatedBy string `json:"created_by,omitempty" sql:"column:_created_by"`
// Last date of object modification
// Read Only: true
UpdatedAt strfmt.DateTime `json:"updated_at,omitempty" sql:"column:_updated_at"`
// User that updated the object
// Read Only: true
UpdatedBy string `json:"updated_by,omitempty" sql:"column:_updated_by"`
// meta
Meta StringMap `json:"meta,omitempty"`
// tags
Tags StringArray `json:"tags,omitempty"`
}
Model is the base datebase model type used by Model Rocket
func (*Model) BeforeCreate ¶ added in v1.3.0
BeforeCreate hooks the gorm on create
func (*Model) MarshalBinary ¶
MarshalBinary interface implementation
func (*Model) UnmarshalBinary ¶
UnmarshalBinary interface implementation
type Params ¶
type Params = StringMap
Params is a simple type alias for a Map
func ParseStringParams ¶
ParseStringParams parses a parameter string and returns a params object Example string: foo=bar aparam="value"
type Profile ¶ added in v1.3.1
type Profile struct {
openid.StandardClaims
// extended attributes
ExtendedAttributes map[string]string `json:"extendedAttributes,omitempty"`
}
Profile A record profile, optional user/client data. swagger:model Profile
func (*Profile) MarshalBinary ¶ added in v1.3.1
MarshalBinary interface implementation
func (Profile) MarshalJSON ¶ added in v1.3.1
MarshalJSON marshals this object to a JSON structure
func (*Profile) UnmarshalBinary ¶ added in v1.3.1
UnmarshalBinary interface implementation
func (*Profile) UnmarshalJSON ¶ added in v1.3.1
UnmarshalJSON unmarshals this object from a JSON structure
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response defines a simple middleware.Responder struct
func NewResponse ¶
func NewResponse(options ...*ResponseOptions) *Response
NewResponse returns a new response object
func (*Response) SetAcceleration ¶
SetAcceleration enables json acceleration
func (*Response) SetHeaderMap ¶
SetHeaderMap sets additional response headers
func (*Response) SetHeaders ¶
SetHeaders sets all of the headers
func (*Response) SetOptions ¶
func (r *Response) SetOptions(options ...*ResponseOptions) *Response
SetOptions sets the options for a response
func (*Response) SetPayload ¶
SetPayload sets the payload
func (*Response) StatusCode ¶
StatusCode returns the response http status code
func (*Response) WriteHeader ¶
WriteHeader implements the http.ResponseWriter.WriteHeader() method
func (*Response) WriteResponse ¶
func (r *Response) WriteResponse(rw http.ResponseWriter, pr runtime.Producer)
WriteResponse implements the middleware.Responder.WriteResponse() method
type ResponseOptions ¶
type ResponseOptions struct {
Request *http.Request
Encoding string
ContentType string
Binary bool
Acceleration bool
}
ResponseOptions defines responder options
type Slicer ¶ added in v1.1.0
type Slicer interface {
Append(vals ...interface{})
Insert(index int, val interface{})
IndexOf(val interface{}) int
Remove(index int)
Map(out interface{}, filters ...MapFilter)
Contains(values ...interface{}) bool
ContainsAny(values ...interface{}) bool
}
Slicer is a generic slice manipulation interface helper
type StringArray ¶
type StringArray pq.StringArray
StringArray is a proper string array type
func (*StringArray) Scan ¶
func (a *StringArray) Scan(src interface{}) error
Scan implements the sql.Scanner interface
type StringMap ¶
type StringMap map[string]interface{}
StringMap is a wrapper on a map[string]interface{} that implements the Mapper interface
func (StringMap) Delete ¶ added in v1.1.0
func (p StringMap) Delete(key interface{})
Delete removes a key
func (StringMap) Get ¶ added in v1.1.0
func (p StringMap) Get(key interface{}) interface{}
Get returns the value and if the key is set
func (StringMap) Set ¶ added in v1.1.0
func (p StringMap) Set(key, value interface{})
Set sets a value in the map
func (StringMap) String ¶ added in v1.1.0
String returns a string value for the param, or the optional default
func (StringMap) StringSlice ¶ added in v1.1.0
StringSlice returns a string value for the param, or the optional default
type Ticker ¶ added in v1.1.1
type Ticker struct {
// contains filtered or unexported fields
}
Ticker is a ticker wrapper with some extra functionality
type UUIDArray ¶
UUIDArray is a proper string array type
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value defines a value wrapper
func (Value) Interface ¶ added in v1.1.0
func (v Value) Interface() interface{}
Interface returns the underlying interface for the value
func (Value) Slice ¶ added in v1.3.0
func (v Value) Slice() []interface{}
Slice returns the value cast as []interface{}
func (Value) StringSlice ¶
StringSlice casts the value to a string slice
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
encoding/postgis
Package postgis implements Well Known Binary encoding and decoding.
|
Package postgis implements Well Known Binary encoding and decoding. |
|
Package ptr provides some helpers for converting types to pointers
|
Package ptr provides some helpers for converting types to pointers |