Documentation ¶
Index ¶
- func SetObjectProperties(obj interface{}, edits map[string]interface{}, ctx aero.Context) error
- type API
- func (api *API) ActionHandler(action *Action) (string, aero.Handler)
- func (api *API) ArrayAppend(collection string) (string, aero.Handler)
- func (api *API) ArrayRemove(collection string) (string, aero.Handler)
- func (api *API) Create(collection string) (string, aero.Handler)
- func (api *API) Delete(collection string) (string, aero.Handler)
- func (api *API) Edit(collection string) (string, aero.Handler)
- func (api *API) EditField(collection string) (string, aero.Handler)
- func (api *API) Get(collection string) (string, aero.Handler)
- func (api *API) GetField(collection string) (string, aero.Handler)
- func (api *API) Install(app *aero.Application)
- func (api *API) RegisterAction(action *Action)
- func (api *API) RegisterActions(collection string, actions []*Action)
- func (api *API) RegisterCollection(app *aero.Application, collection string, objType reflect.Type)
- func (api *API) Type(collection string) reflect.Type
- type Action
- type Actionable
- type AfterEditable
- type ArrayEventListener
- type Authorizable
- type Creatable
- type CustomEditable
- type Database
- type Deletable
- type Editable
- type Filter
- type Newable
- type Savable
- type VirtualEditable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
API represents your application's API configuration.
func (*API) ActionHandler ¶
ActionHandler ...
func (*API) ArrayAppend ¶
ArrayAppend ...
func (*API) ArrayRemove ¶
ArrayRemove ...
func (*API) Install ¶
func (api *API) Install(app *aero.Application)
Install installs the REST & GraphQL API to your webserver at the given endpoint.
func (*API) RegisterAction ¶
RegisterAction registers an action for a collection.
func (*API) RegisterActions ¶
RegisterActions registers actions for a collection.
func (*API) RegisterCollection ¶ added in v0.1.7
RegisterCollection registers a single collection.
type Action ¶
type Action struct { Collection string Name string Route string Run func(obj interface{}, ctx aero.Context) error }
Action defines a single action on a given datatype.
type Actionable ¶
type Actionable interface { Authorizable }
Actionable means the data type can execute actions.
type AfterEditable ¶
An AfterEditable is called after the editing process happens and before the object is saved.
type ArrayEventListener ¶
type ArrayEventListener interface { OnAppend(ctx aero.Context, field string, index int, obj interface{}) OnRemove(ctx aero.Context, field string, index int, obj interface{}) }
ArrayEventListener means the data type can authorize changes.
type Authorizable ¶
type Authorizable interface { // Authorize returns an error if the given API request is not authorized. Authorize(ctx aero.Context, action string) error }
Authorizable means the data type can authorize changes.
type CustomEditable ¶
type CustomEditable interface {
Edit(ctx aero.Context, key string, value reflect.Value, newValue reflect.Value) (consumed bool, err error)
}
A CustomEditable has its own implementation on how to edit certain object fields.
type Database ¶
type Database interface { Get(collection string, id string) (interface{}, error) Set(collection string, id string, obj interface{}) Delete(collection string, id string) bool Types() map[string]reflect.Type }
Database is an interface for any kind of database.
type Deletable ¶
type Deletable interface { Authorizable DeleteInContext(aero.Context) error Delete() error }
Deletable defines an object type that can be deleted from the database.
type Editable ¶
type Editable interface { Authorizable Savable }
An Editable can authorize changes, be changed and be saved in the database.
type Filter ¶
Filter describes an object with private data that needs to be filtered in the public API.
type Newable ¶
type Newable interface { Savable Authorizable Creatable }
Newable defines an object type where new instances can be created by users and saved in the database.