Documentation
¶
Index ¶
- Constants
- func ApiLog() *apiLog
- type ApiError
- type ApiErrorCategory
- type Context
- type EType
- type Endpoint
- type ErrorField
- type IAuthSdk
- type IContext
- type IDb
- type IModel
- type IServer
- type MDb
- type MModel
- func (m *MModel) DeleteByFilter(filter interface{}) error
- func (m *MModel) FindByFilter(filter interface{}, sort interface{}, pagination MPagination, docs interface{}) error
- func (m *MModel) Insert(doc interface{}) (string, error)
- func (m *MModel) UpdateByFilter(filter interface{}, toChange interface{}) error
- type MPagination
- type MSortType
- type Server
- func (a *Server) Delete(url string, handler Endpoint)
- func (a *Server) Get(url string, handler Endpoint)
- func (a *Server) LoadEnv(filenames ...string) error
- func (a *Server) Post(url string, handler Endpoint)
- func (a *Server) Put(url string, handler Endpoint)
- func (a *Server) Run() error
- func (a *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type TenantDoc
- type Void
Constants ¶
View Source
const ( InternalServerErrorCategory ApiErrorCategory = "ISE" RequestErrorCategory = "RQE" DBErrorCategory = "DBE" CacheErrorCategory = "CCE" ServiceErrorCategory = "SVE" UtilityErrorCategory = "UTE" )
View Source
const ( INFO logLevel = 1 DEBUG = 2 WARNING = 3 ERROR = 4 )
View Source
const ( HeaderFieldValidation EType = "headerField" BodyFieldValidation = "bodyField" QueryFieldValidation = "queryField" ParamFieldValidation = "paramField" GenericValidation = "generic" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ApiError ¶
type ApiError struct { Service string `json:"Service"` Operation string `json:"Operation"` Category ApiErrorCategory `json:"Category"` StatusCode int `json:"-"` Messages []ErrorField `json:"Messages"` }
ApiError is the error that will be processed and formatted to the client on the response.
func (*ApiError) AddFieldMessage ¶
func (*ApiError) AddGenericMessage ¶
func (*ApiError) ContainsErrors ¶
type ApiErrorCategory ¶
type ApiErrorCategory string
ApiErrorCategory describes the type of error thrown by the api
type Context ¶
type Context struct { Res http.ResponseWriter Req *http.Request Param httprouter.Params }
func NewContext ¶
func NewContext(w http.ResponseWriter, r *http.Request, p httprouter.Params) *Context
func (*Context) ValidateBody ¶
func (*Context) ValidateHeader ¶
func (*Context) ValidateParam ¶
func (*Context) ValidateQuery ¶
type Endpoint ¶
func RequireTenantToken ¶
type ErrorField ¶
type IModel ¶
type IModel interface { Insert(doc interface{}) (string, error) UpdateByFilter(filter interface{}, toChange interface{}) error FindByFilter(filter interface{}, sort interface{}, pagination MPagination, docs interface{}) error DeleteByFilter(filter interface{}) error }
IModel required interface for CRUD Model operations for both all data associated to a single resource
type MDb ¶
func NewDb ¶
NewDb creates Database instance, connects to mongo and complies with IMongoDatabase interface
func (*MDb) Disconnect ¶
type MModel ¶
type MModel struct {
*mongo.Collection
}
func (*MModel) DeleteByFilter ¶
func (*MModel) FindByFilter ¶
func (m *MModel) FindByFilter(filter interface{}, sort interface{}, pagination MPagination, docs interface{}) error
func (*MModel) UpdateByFilter ¶
type MPagination ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.