Documentation ¶
Index ¶
- func GetIDAsString(idToConvert interface{}) string
- func ParseFilter(filter string) *wst.Filter
- type ACL
- type BearerRole
- type BearerToken
- type BearerUser
- type CasbinConfig
- type Config
- type DataSourceConfig
- type EventContext
- type Model
- func (loadedModel *Model) Build(data wst.M, fromDb bool, baseContext *EventContext) ModelInstance
- func (loadedModel *Model) Create(data interface{}, baseContext *EventContext) (*ModelInstance, error)
- func (loadedModel *Model) DeleteById(id interface{}) (int64, error)
- func (loadedModel *Model) ExtractLookupsFromFilter(filterMap *wst.Filter) *wst.A
- func (loadedModel *Model) FindById(id interface{}, filterMap *wst.Filter, baseContext *EventContext) (*ModelInstance, error)
- func (loadedModel *Model) FindMany(filterMap *wst.Filter, baseContext *EventContext) ([]ModelInstance, error)
- func (loadedModel *Model) FindOne(filterMap *wst.Filter, baseContext *EventContext) (*ModelInstance, error)
- func (loadedModel *Model) GetHandler(event string) func(eventContext *EventContext) error
- func (loadedModel *Model) HandleRemoteMethod(name string, 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(context *EventContext) error, options RemoteMethodOptions) fiber.Router
- func (loadedModel *Model) SendError(ctx *fiber.Ctx, err error) error
- type ModelInstance
- func (modelInstance ModelInstance) Get(relationName string) interface{}
- func (modelInstance ModelInstance) GetMany(relationName string) []ModelInstance
- func (modelInstance ModelInstance) GetOne(relationName string) *ModelInstance
- func (modelInstance ModelInstance) HideProperties()
- func (modelInstance *ModelInstance) Reload(eventContext *EventContext) error
- func (modelInstance *ModelInstance) ToJSON() wst.M
- func (modelInstance ModelInstance) Transform(out interface{}) error
- func (modelInstance ModelInstance) UncheckedTransform(out interface{}) interface{}
- func (modelInstance *ModelInstance) UpdateAttributes(data interface{}, baseContext *EventContext) (*ModelInstance, error)
- type OperationItem
- type Property
- type RegistryEntry
- type Relation
- type RemoteMethodOptions
- type RemoteMethodOptionsHttp
- type WeStackError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetIDAsString ¶ added in v1.2.44
func GetIDAsString(idToConvert interface{}) string
func ParseFilter ¶ added in v1.2.39
func ParseFilter(filter string) *wst.Filter
Types ¶
type BearerRole ¶ added in v1.2.44
type BearerRole struct {
Name string
}
type BearerToken ¶ added in v1.2.44
type BearerToken struct { User *BearerUser Roles []BearerRole }
type BearerUser ¶ added in v1.2.44
type BearerUser struct { Id interface{} Data interface{} }
type CasbinConfig ¶ added in v1.2.44
type CasbinConfig struct { RequestDefinition string `json:"requestDefinition"` PolicyDefinition string `json:"policyDefinition"` RoleDefinition string `json:"roleDefinition"` PolicyEffect string `json:"policyEffect"` MatchersDefinition string `json:"matchersDefinition"` Policies []string `json:"policies"` }
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"` Casbin CasbinConfig `json:"casbin"` }
type DataSourceConfig ¶
type EventContext ¶
type EventContext struct { Bearer *BearerToken BaseContext *EventContext Filter *wst.Filter Data *wst.M Instance *ModelInstance Ctx *fiber.Ctx Ephemeral *wst.M IsNewInstance bool Result interface{} ModelID interface{} StatusCode int }
func (*EventContext) GetBearer ¶ added in v1.2.44
func (ctx *EventContext) GetBearer(loadedModel *Model) (error, *BearerToken)
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 `json:"-"` Datasource *datasource.Datasource `json:"-"` Router *fiber.Router `json:"-"` App *wst.IApp `json:"-"` BaseUrl string `json:"-"` CasbinModel *casbinmodel.Model CasbinAdapter **fileadapter.Adapter Enforcer *casbin.Enforcer // contains filtered or unexported fields }
func (*Model) Build ¶
func (loadedModel *Model) Build(data wst.M, fromDb bool, baseContext *EventContext) ModelInstance
func (*Model) Create ¶
func (loadedModel *Model) Create(data interface{}, baseContext *EventContext) (*ModelInstance, error)
func (*Model) DeleteById ¶
func (*Model) ExtractLookupsFromFilter ¶ added in v1.2.18
func (loadedModel *Model) ExtractLookupsFromFilter(filterMap *wst.Filter) *wst.A
func (*Model) FindById ¶
func (loadedModel *Model) FindById(id interface{}, filterMap *wst.Filter, baseContext *EventContext) (*ModelInstance, error)
func (*Model) FindMany ¶
func (loadedModel *Model) FindMany(filterMap *wst.Filter, baseContext *EventContext) ([]ModelInstance, error)
func (*Model) FindOne ¶
func (loadedModel *Model) FindOne(filterMap *wst.Filter, baseContext *EventContext) (*ModelInstance, error)
func (*Model) GetHandler ¶
func (loadedModel *Model) GetHandler(event string) func(eventContext *EventContext) error
func (*Model) HandleRemoteMethod ¶ added in v1.2.44
func (loadedModel *Model) HandleRemoteMethod(name string, 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(context *EventContext) error, options RemoteMethodOptions) fiber.Router
type ModelInstance ¶
type ModelInstance struct { Model *Model Id interface{} // contains filtered or unexported fields }
func (ModelInstance) Get ¶ added in v1.2.26
func (modelInstance ModelInstance) Get(relationName string) interface{}
func (ModelInstance) GetMany ¶ added in v1.2.30
func (modelInstance ModelInstance) GetMany(relationName string) []ModelInstance
func (ModelInstance) GetOne ¶ added in v1.2.30
func (modelInstance ModelInstance) GetOne(relationName string) *ModelInstance
func (ModelInstance) HideProperties ¶ added in v1.2.20
func (modelInstance ModelInstance) HideProperties()
func (*ModelInstance) Reload ¶ added in v1.2.31
func (modelInstance *ModelInstance) Reload(eventContext *EventContext) error
func (*ModelInstance) ToJSON ¶
func (modelInstance *ModelInstance) ToJSON() wst.M
func (ModelInstance) Transform ¶
func (modelInstance ModelInstance) Transform(out interface{}) error
func (ModelInstance) UncheckedTransform ¶ added in v1.2.31
func (modelInstance ModelInstance) UncheckedTransform(out interface{}) interface{}
func (*ModelInstance) UpdateAttributes ¶
func (modelInstance *ModelInstance) UpdateAttributes(data interface{}, baseContext *EventContext) (*ModelInstance, error)
type OperationItem ¶ added in v1.2.44
type OperationItem struct { Handler func(context *EventContext) error Options RemoteMethodOptions }
type Property ¶
type Property struct { Type interface{} `json:"type"` Required bool `json:"required"` Default interface{} `json:"default"` }
type RegistryEntry ¶
type RemoteMethodOptions ¶
type RemoteMethodOptions struct { Name string 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.