Documentation ¶
Index ¶
- type ACL
- type Config
- type DataSourceConfig
- type EventContext
- type Model
- func (loadedModel *Model) Build(data bson.M, fromDb bool) ModelInstance
- func (loadedModel *Model) Create(data interface{}) (*ModelInstance, error)
- func (loadedModel *Model) DeleteById(id interface{}) (int64, error)
- func (loadedModel *Model) FindById(id interface{}, filterMap *map[string]interface{}) (*ModelInstance, error)
- func (loadedModel *Model) FindByIdRoute(c *fiber.Ctx) error
- func (loadedModel *Model) FindMany(filterMap *map[string]interface{}) ([]ModelInstance, error)
- func (loadedModel *Model) FindManyRoute(c *fiber.Ctx) error
- func (loadedModel *Model) FindOne(filterMap *map[string]interface{}) (*ModelInstance, error)
- func (loadedModel *Model) GetHandler(event string) func(eventContext *EventContext) error
- func (loadedModel *Model) Observe(operation string, handler func(eventContext *EventContext) error)
- func (loadedModel *Model) On(event string, handler func(eventContext *EventContext) error)
- func (loadedModel *Model) RemoteMethod(handler func(c *fiber.Ctx) error, options RemoteMethodOptions) fiber.Router
- func (loadedModel *Model) SendError(ctx *fiber.Ctx, err error) error
- type ModelInstance
- type Property
- type RegistryEntry
- type Relation
- type RemoteMethodOptions
- type RemoteMethodOptionsHttp
- type WeStackError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Name string `json:"name"` Plural string `json:"plural"` Base string `json:"base"` Datasource string `json:"dataSource"` Public bool `json:"public"` Properties map[string]Property `json:"properties"` Relations map[string]Relation `json:"relations"` Acls []ACL `json:"acls"` Hidden []string `json:"hidden"` }
type DataSourceConfig ¶
type EventContext ¶
type EventContext struct { Data *bson.M Instance *ModelInstance Ctx *fiber.Ctx IsNewInstance bool Result interface{} ModelID interface{} StatusCode int }
func (*EventContext) RestError ¶
func (ctx *EventContext) RestError(fiberError *fiber.Error, details fiber.Map) error
type Model ¶
type Model struct { Name string `json:"name"` Config Config Datasource *datasource.Datasource Router *fiber.Router App *common.IApp BaseUrl string // contains filtered or unexported fields }
func (*Model) Create ¶
func (loadedModel *Model) Create(data interface{}) (*ModelInstance, error)
func (*Model) DeleteById ¶
func (*Model) FindById ¶
func (loadedModel *Model) FindById(id interface{}, filterMap *map[string]interface{}) (*ModelInstance, error)
func (*Model) FindByIdRoute ¶
func (*Model) FindMany ¶
func (loadedModel *Model) FindMany(filterMap *map[string]interface{}) ([]ModelInstance, error)
func (*Model) FindManyRoute ¶
func (*Model) FindOne ¶
func (loadedModel *Model) FindOne(filterMap *map[string]interface{}) (*ModelInstance, error)
func (*Model) GetHandler ¶
func (loadedModel *Model) GetHandler(event string) func(eventContext *EventContext) error
func (*Model) Observe ¶
func (loadedModel *Model) Observe(operation string, handler func(eventContext *EventContext) error)
func (*Model) On ¶
func (loadedModel *Model) On(event string, handler func(eventContext *EventContext) error)
func (*Model) RemoteMethod ¶
func (loadedModel *Model) RemoteMethod(handler func(c *fiber.Ctx) error, options RemoteMethodOptions) fiber.Router
type ModelInstance ¶
type ModelInstance struct { Model *Model Id interface{} // contains filtered or unexported fields }
func (ModelInstance) ToJSON ¶
func (modelInstance ModelInstance) ToJSON() map[string]interface{}
func (ModelInstance) Transform ¶
func (modelInstance ModelInstance) Transform(out interface{}) error
func (*ModelInstance) UpdateAttributes ¶
func (modelInstance *ModelInstance) UpdateAttributes(data interface{}) (*ModelInstance, error)
type Property ¶
type Property struct { Type interface{} `json:"type"` Required bool `json:"required"` Default interface{} `json:"default"` }
type RegistryEntry ¶
type RemoteMethodOptions ¶
type RemoteMethodOptions struct { Description string Http RemoteMethodOptionsHttp }
type RemoteMethodOptionsHttp ¶
type WeStackError ¶
type WeStackError struct { FiberError *fiber.Error Details fiber.Map Ctx *EventContext }
func (*WeStackError) Error ¶
func (err *WeStackError) Error() string
Click to show internal directories.
Click to hide internal directories.