Documentation ¶
Index ¶
- Constants
- func IndexOfString(slice []string, item string) int
- type BaseProvider
- func (p *BaseProvider) AddFilter(k, v string)
- func (p *BaseProvider) GetFilters() Filters
- func (p *BaseProvider) GetSkip() uint64
- func (p *BaseProvider) GetSort() string
- func (p *BaseProvider) GetStat() bool
- func (p *BaseProvider) GetTake() uint64
- func (p *BaseProvider) LimitFilterKeys(keys ...string)
- func (p *BaseProvider) LimitSortKeys(keys ...string)
- func (p *BaseProvider) ParseRequest(r *http.Request)
- func (p *BaseProvider) SetSkip(v uint64)
- func (p *BaseProvider) SetSort(k string)
- func (p *BaseProvider) SetStat(v bool)
- func (p *BaseProvider) SetTake(v uint64)
- type Delegate
- type Filter
- type Filters
- type JSONTime
- type NullTime
- type Pager
- type Provider
- type ProviderResponse
- type RequestWrapper
- type ResponseWrapper
- type Sorter
- type SqlProvider
- type SquirrelDBProxy
- type Txx
- type ValidationContext
- type ValidationError
- type ValidationErrorInterface
- type ValidationErrors
Constants ¶
View Source
const JSONTimeLayout string = "\"2006-01-02T15:04:05.000Z\""
View Source
const MaxNumOfFilterValue int = 5
View Source
const MaxTake uint64 = 30
Variables ¶
This section is empty.
Functions ¶
func IndexOfString ¶
Types ¶
type BaseProvider ¶
type BaseProvider struct {
// contains filtered or unexported fields
}
func NewBaseProvider ¶
func NewBaseProvider() *BaseProvider
func (*BaseProvider) AddFilter ¶
func (p *BaseProvider) AddFilter(k, v string)
func (*BaseProvider) GetFilters ¶
func (p *BaseProvider) GetFilters() Filters
func (*BaseProvider) GetSkip ¶
func (p *BaseProvider) GetSkip() uint64
func (*BaseProvider) GetSort ¶
func (p *BaseProvider) GetSort() string
func (*BaseProvider) GetStat ¶
func (p *BaseProvider) GetStat() bool
func (*BaseProvider) GetTake ¶
func (p *BaseProvider) GetTake() uint64
func (*BaseProvider) LimitFilterKeys ¶
func (p *BaseProvider) LimitFilterKeys(keys ...string)
func (*BaseProvider) LimitSortKeys ¶
func (p *BaseProvider) LimitSortKeys(keys ...string)
func (*BaseProvider) ParseRequest ¶
func (p *BaseProvider) ParseRequest(r *http.Request)
func (*BaseProvider) SetSkip ¶
func (p *BaseProvider) SetSkip(v uint64)
func (*BaseProvider) SetSort ¶
func (p *BaseProvider) SetSort(k string)
func (*BaseProvider) SetStat ¶
func (p *BaseProvider) SetStat(v bool)
func (*BaseProvider) SetTake ¶
func (p *BaseProvider) SetTake(v uint64)
type NullTime ¶
func (NullTime) MarshalJSON ¶
func (*NullTime) UnmarshalJSON ¶
type ProviderResponse ¶
type RequestWrapper ¶
func Request ¶
func Request(r *http.Request) RequestWrapper
func (RequestWrapper) DecodeBody ¶
func (r RequestWrapper) DecodeBody(to interface{}) error
type ResponseWrapper ¶
type ResponseWrapper struct {
http.ResponseWriter
}
func Response ¶
func Response(w http.ResponseWriter) ResponseWrapper
func (ResponseWrapper) Error ¶
func (r ResponseWrapper) Error(message interface{}, args ...interface{})
func (ResponseWrapper) RawError ¶
func (r ResponseWrapper) RawError(message interface{}, args ...interface{})
func (ResponseWrapper) Send ¶
func (r ResponseWrapper) Send(status int, data ...interface{})
type SqlProvider ¶
type SqlProvider struct { *BaseProvider // contains filtered or unexported fields }
func NewSqlProvider ¶
func NewSqlProvider(dbx *sqlx.DB, table string, s interface{}) *SqlProvider
func (*SqlProvider) ParseStruct ¶
func (p *SqlProvider) ParseStruct(s interface{})
func (*SqlProvider) Read ¶
func (p *SqlProvider) Read(dst interface{}) (*ProviderResponse, error)
func (*SqlProvider) SetWhere ¶
func (p *SqlProvider) SetWhere(where map[string]interface{})
type SquirrelDBProxy ¶
func (*SquirrelDBProxy) QueryRow ¶
func (p *SquirrelDBProxy) QueryRow(sql string, args ...interface{}) squirrel.RowScanner
type Txx ¶
func (Txx) RollbackWithErrorf ¶
type ValidationContext ¶
type ValidationContext struct {
// contains filtered or unexported fields
}
func NewValidationContext ¶
func NewValidationContext() *ValidationContext
func (*ValidationContext) AddError ¶
func (v *ValidationContext) AddError(key, message string)
func (*ValidationContext) Errors ¶
func (v *ValidationContext) Errors() ValidationErrors
func (*ValidationContext) HasError ¶
func (v *ValidationContext) HasError() bool
func (*ValidationContext) ToError ¶
func (v *ValidationContext) ToError() *ValidationError
type ValidationError ¶
type ValidationError struct {
// contains filtered or unexported fields
}
func NewValidationError ¶
func NewValidationError(v *ValidationContext) *ValidationError
func (*ValidationError) Error ¶
func (ve *ValidationError) Error() string
func (*ValidationError) ToResponseData ¶
func (ve *ValidationError) ToResponseData() map[string]interface{}
func (*ValidationError) ValidationErrors ¶
func (ve *ValidationError) ValidationErrors() ValidationErrors
type ValidationErrorInterface ¶
type ValidationErrorInterface interface { ValidationErrors() ValidationErrors ToResponseData() map[string]interface{} }
type ValidationErrors ¶
Click to show internal directories.
Click to hide internal directories.