Documentation ¶
Index ¶
- func NewMemoryStore() *crud.MemoryStore[Action, Action, Filters]
- func Router(service *Service, authService auth.Service) func(chi.Router)
- type Action
- type Authorizer
- func (a *Authorizer) Create(ctx context.Context, action *Action) (*Action, error)
- func (a *Authorizer) Delete(ctx context.Context, id string) error
- func (a *Authorizer) Find(ctx context.Context, params *crud.FindParams[Filters]) ([]*Action, int, error)
- func (a *Authorizer) FindByID(ctx context.Context, id string) (*Action, error)
- func (a *Authorizer) Update(ctx context.Context, action *Action) (*Action, error)
- type CreateRequest
- type CreateResponse
- type DeleteRequest
- type DeleteResponse
- type Filters
- type FindByIDRequest
- type FindByIDResponse
- type FindResponse
- type Function
- type RunRequest
- type RunResponse
- type Service
- type SqlStore
- type Storer
- type UpdateRequest
- type UpdateResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMemoryStore ¶
func NewMemoryStore() *crud.MemoryStore[Action, Action, Filters]
NewMemoryStore returns a new in memory store.
Types ¶
type Action ¶
type Action struct { Name string `json:"name"` Calls int `json:"calls"` LastCall time.Time `json:"lastCall" db:"last_call"` LastCalledBy string `json:"lastCalledBy" db:"last_called_by"` Error string `json:"error"` }
func (Action) Identifier ¶
type Authorizer ¶
type Authorizer struct {
// contains filtered or unexported fields
}
func NewAuthorizer ¶
func NewAuthorizer(store Storer) *Authorizer
NewAuthorizer wraps the given store with authorization methods.
func (*Authorizer) Delete ¶
func (a *Authorizer) Delete(ctx context.Context, id string) error
Delete is allowed by
- the user owning the action
- an admin
- internally
func (*Authorizer) Find ¶
func (a *Authorizer) Find(ctx context.Context, params *crud.FindParams[Filters]) ([]*Action, int, error)
Find is allowed by
- an admin
- internally
type CreateRequest ¶
type CreateRequest struct { // in:body Action *Action }
swagger:parameters createAction
type CreateResponse ¶
type CreateResponse struct { // in:body Action *Action }
swagger:response createActionResponse
type DeleteRequest ¶
type DeleteRequest struct { // in:query ID string `json:"id"` }
swagger:parameters deleteAction
type FindByIDRequest ¶
type FindByIDRequest struct { // in:query ID string `json:"id"` }
swagger:parameters findAction
type FindByIDResponse ¶
type FindByIDResponse struct { // in:body Action *Action }
swagger:response findActionResponse
type FindResponse ¶
type FindResponse struct { // in:body Actions []*Action // in:header TotalActions int `json:"x-total-count"` }
swagger:response findActionsResponse
type RunRequest ¶
type RunRequest struct { // in:body Name string `json:"name"` }
swagger:parameters deleteAction
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
type SqlStore ¶
type SqlStore struct { *crud.SqlStore[Action, Action, Filters] // contains filtered or unexported fields }
func NewSqlStore ¶
NewSqlStore returns a new sql store for notifications.
type UpdateRequest ¶
type UpdateRequest struct { // in:body Action *Action }
swagger:parameters updateAction
type UpdateResponse ¶
type UpdateResponse struct { // in:body Action *Action }
swagger:response updateActionResponse
Click to show internal directories.
Click to hide internal directories.