Documentation ¶
Index ¶
- Constants
- func ValidateInput(rs requestscope.RequestScope, extras interface{}, req, res messages.Message, ...) (editedReq, editedRes messages.Message, editedRs requestscope.RequestScope, ...)
- type DataProvider
- func (ma *DataProvider) Connect() (err *utils.Error)
- func (ma DataProvider) Create(collection string, data map[string]interface{}) (response map[string]interface{}, err *utils.Error)
- func (ma DataProvider) CreateFile(data io.ReadCloser) (response map[string]interface{}, err *utils.Error)
- func (ma DataProvider) Delete(collection string, id string) (response map[string]interface{}, err *utils.Error)
- func (ma DataProvider) Get(collection string, id string) (response map[string]interface{}, err *utils.Error)
- func (ma DataProvider) GetFile(id string) (response []byte, err *utils.Error)
- func (ma *DataProvider) Init() (err *utils.Error)
- func (ma DataProvider) Query(collection string, parameters map[string][]string) (response map[string]interface{}, err *utils.Error)
- func (ma DataProvider) Update(collection string, id string, data map[string]interface{}) (response map[string]interface{}, err *utils.Error)
Constants ¶
View Source
const ( // fields of the objects in db ID = "_id" CreatedAt = "createdAt" UpdatedAt = "updatedAt" // field used to return lists List = "results" )
Variables ¶
This section is empty.
Functions ¶
func ValidateInput ¶
func ValidateInput(rs requestscope.RequestScope, extras interface{}, req, res messages.Message, db dataprovider.Provider) (editedReq, editedRes messages.Message, editedRs requestscope.RequestScope, err *utils.Error)
Checks body of the request. Returns error if the request body contains any restricted fields. Must be added to POST and PUT requests for all paths. Example Usage: core.Interceptors.Add(interceptors.AnyPath, methods.Post, interceptors.BEFORE_EXEC, mongoutil.ValidateInput, nil) core.Interceptors.Add(interceptors.AnyPath, methods.Put, interceptors.BEFORE_EXEC, mongoutil.ValidateInput, nil)
Types ¶
type DataProvider ¶
type DataProvider struct { Addresses []string Database string AuthDatabase string Username string Password string Collections map[string]bool // contains filtered or unexported fields }
func (*DataProvider) Connect ¶
func (ma *DataProvider) Connect() (err *utils.Error)
func (DataProvider) CreateFile ¶
func (ma DataProvider) CreateFile(data io.ReadCloser) (response map[string]interface{}, err *utils.Error)
func (DataProvider) GetFile ¶
func (ma DataProvider) GetFile(id string) (response []byte, err *utils.Error)
func (*DataProvider) Init ¶
func (ma *DataProvider) Init() (err *utils.Error)
Click to show internal directories.
Click to hide internal directories.