Documentation
¶
Index ¶
- func AddServiceToServer(s Server, service Service)
- func ConstructResourceEndpoint(ep ResourceEndpointI, resourceType string, op api.Operation)
- func FullRequestPath(r Request) string
- func FullRequestServicePath(r Request) string
- func InitResourceEndpoint(ep ResourceEndpointI, resourceType string, operationName string, ...)
- func ParseDbQuery(request Request, model interface{}, queryName string, cmd ...api.Query) (*db.Filter, error)
- func SetResponseList(r Request, response api.ResponseListI, resourceType ...string)
- func UniqueFormData(request Request) map[string]string
- type CheckAccess
- type CheckAccessEndpoint
- type CheckAccessResourceEndpoint
- type CheckStatusEndpoint
- type DynamicFieldTranslator
- type DynamicTable
- type DynamicTableConfig
- type DynamicTableEndpoint
- type DynamicTableField
- type DynamicTableQuery
- type DynamicTables
- type DynamicTablesService
- type EchoEndpoint
- type Endpoint
- type EndpointBase
- type EndpointHandler
- type EndpointNoHandler
- type EnumEntry
- type EnumGetter
- type FieldEnums
- type File
- type Request
- type RequestBase
- type ResourceEndpoint
- type ResourceEndpointI
- type Response
- type ResponseBase
- func (r *ResponseBase) File() *File
- func (r *ResponseBase) Message() interface{}
- func (r *ResponseBase) RedirectPath() string
- func (r *ResponseBase) Request() Request
- func (r *ResponseBase) SetFile(file *File)
- func (r *ResponseBase) SetMessage(message api.Response)
- func (r *ResponseBase) SetRedirectPath(path string)
- func (r *ResponseBase) SetRequest(request Request)
- func (r *ResponseBase) SetStatusMessage(status string)
- func (r *ResponseBase) SetSuccessStatusMessage()
- func (r *ResponseBase) SetText(text string)
- func (r *ResponseBase) Text() string
- type Server
- type ServerBaseConfig
- type Service
- type ServiceBase
- func (s *ServiceBase) AddDynamicTables(tables ...*DynamicTableConfig)
- func (s *ServiceBase) AttachToServer(server Server) error
- func (s *ServiceBase) DynamicTables() []*DynamicTableConfig
- func (s *ServiceBase) Init(pathName string, multitenancy ...bool)
- func (s *ServiceBase) Server() Server
- func (s *ServiceBase) SetSupportsMultitenancy(enable bool)
- func (s *ServiceBase) SupportsMultitenancy() bool
- type ServiceEachEndpointHandler
- type StatusResponse
- type StatusService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddServiceToServer ¶
func ConstructResourceEndpoint ¶
func ConstructResourceEndpoint(ep ResourceEndpointI, resourceType string, op api.Operation)
func FullRequestPath ¶
func FullRequestServicePath ¶
func InitResourceEndpoint ¶
func InitResourceEndpoint(ep ResourceEndpointI, resourceType string, operationName string, accessType ...access_control.AccessType)
func ParseDbQuery ¶
func SetResponseList ¶
func SetResponseList(r Request, response api.ResponseListI, resourceType ...string)
func UniqueFormData ¶
Types ¶
type CheckAccess ¶
type CheckAccess struct{}
func (*CheckAccess) HandleRequest ¶
func (e *CheckAccess) HandleRequest(request Request) error
type CheckAccessEndpoint ¶
type CheckAccessEndpoint struct { EndpointBase CheckAccess }
func NewCheckAccessEndpoint ¶
func NewCheckAccessEndpoint(operationName string, accessType ...access_control.AccessType) *CheckAccessEndpoint
type CheckAccessResourceEndpoint ¶
type CheckAccessResourceEndpoint struct { ResourceEndpoint CheckAccess }
func NewCheckAccessResourceEndpoint ¶
func NewCheckAccessResourceEndpoint(resource string, operationName string, accessType ...access_control.AccessType) *CheckAccessResourceEndpoint
type CheckStatusEndpoint ¶
type CheckStatusEndpoint struct {
ResourceEndpoint
}
func NewCheckStatusEndpoint ¶
func NewCheckStatusEndpoint() *CheckStatusEndpoint
func (*CheckStatusEndpoint) HandleRequest ¶
func (e *CheckStatusEndpoint) HandleRequest(request Request) error
type DynamicFieldTranslator ¶
type DynamicFieldTranslator interface {
Tr(field *DynamicTableField, tableName ...string) (string, bool)
}
type DynamicTable ¶
type DynamicTable struct { api.ResponseStub Columns []*DynamicTableField `json:"columns"` DefaultSortColumn string `json:"default_sort_column"` DefaultSortDirection string `json:"default_sort_direction"` }
type DynamicTableConfig ¶
type DynamicTableEndpoint ¶
type DynamicTableEndpoint struct { ResourceEndpoint // contains filtered or unexported fields }
func NewDynamicTableEndpoint ¶
func NewDynamicTableEndpoint(service *DynamicTablesService) *DynamicTableEndpoint
func (*DynamicTableEndpoint) HandleRequest ¶
func (e *DynamicTableEndpoint) HandleRequest(request Request) error
type DynamicTableField ¶
type DynamicTableQuery ¶
type DynamicTableQuery struct {
Path string `json:"path" validate:"required" vmessage:"Invalid table path."`
}
type DynamicTables ¶
type DynamicTables interface { AddTable(table *DynamicTableConfig) error Table(request Request, path string) (*DynamicTable, error) SetTranslator(translator DynamicFieldTranslator) }
type DynamicTablesService ¶
type DynamicTablesService struct {
ServiceBase
}
func NewDynamicTablesService ¶
func NewDynamicTablesService(multitenancy ...bool) *DynamicTablesService
type EchoEndpoint ¶
type EchoEndpoint struct {
EndpointBase
}
func NewEchoEndpoint ¶
func NewEchoEndpoint() *EchoEndpoint
func (*EchoEndpoint) HandleRequest ¶
func (e *EchoEndpoint) HandleRequest(request Request) error
type Endpoint ¶
type Endpoint interface { api.Operation generic_error.ErrorsExtender // Handle request to server API. HandleRequest(request Request) error // Precheck request before some authorization methods PrecheckRequestBeforeAuth(request Request, smsMessage *string, skipSms *bool) error }
Interface of API endpoint.
type EndpointBase ¶
type EndpointBase struct { api.Operation generic_error.ErrorsExtenderBase }
Base type for API endpoints.
func (*EndpointBase) Construct ¶
func (e *EndpointBase) Construct(op api.Operation)
func (*EndpointBase) Init ¶
func (e *EndpointBase) Init(operationName string, accessType ...access_control.AccessType)
func (*EndpointBase) PrecheckRequestBeforeAuth ¶
func (e *EndpointBase) PrecheckRequestBeforeAuth(request Request, smsMessage *string, skipSms *bool) error
type EndpointHandler ¶
type EndpointHandler = func(request Request)
type EndpointNoHandler ¶
type EndpointNoHandler struct{}
Base type for API endpoints with empty handlers.
func (*EndpointNoHandler) HandleRequest ¶
func (e *EndpointNoHandler) HandleRequest(request Request) error
type EnumGetter ¶
type FieldEnums ¶
type Request ¶
type Request interface { auth.AuthContext common.WithParameters Server() Server Response() Response Endpoint() Endpoint ParseValidate(cmd interface{}) error FormData() map[string][]string FormFile() (*multipart.FileHeader, error) }
Interface of request to server API.
type RequestBase ¶
type RequestBase struct { auth.TenancyUserContext auth.SessionBase // contains filtered or unexported fields }
func (*RequestBase) Endpoint ¶
func (r *RequestBase) Endpoint() Endpoint
type ResourceEndpoint ¶
type ResourceEndpoint struct { api.ResourceBase EndpointBase }
type ResourceEndpointI ¶
type Response ¶
type Response interface { Message() interface{} SetMessage(message api.Response) SetStatusMessage(status string) SetSuccessStatusMessage() Request() Request SetRequest(request Request) Text() string SetText(text string) SetRedirectPath(path string) RedirectPath() string SetFile(file *File) File() *File }
Interface of response of server API.
type ResponseBase ¶
type ResponseBase struct {
// contains filtered or unexported fields
}
func (*ResponseBase) File ¶
func (r *ResponseBase) File() *File
func (*ResponseBase) Message ¶
func (r *ResponseBase) Message() interface{}
func (*ResponseBase) RedirectPath ¶
func (r *ResponseBase) RedirectPath() string
func (*ResponseBase) Request ¶
func (r *ResponseBase) Request() Request
func (*ResponseBase) SetFile ¶
func (r *ResponseBase) SetFile(file *File)
func (*ResponseBase) SetMessage ¶
func (r *ResponseBase) SetMessage(message api.Response)
func (*ResponseBase) SetRedirectPath ¶
func (r *ResponseBase) SetRedirectPath(path string)
func (*ResponseBase) SetRequest ¶
func (r *ResponseBase) SetRequest(request Request)
func (*ResponseBase) SetStatusMessage ¶
func (r *ResponseBase) SetStatusMessage(status string)
func (*ResponseBase) SetSuccessStatusMessage ¶
func (r *ResponseBase) SetSuccessStatusMessage()
func (*ResponseBase) SetText ¶
func (r *ResponseBase) SetText(text string)
func (*ResponseBase) Text ¶
func (r *ResponseBase) Text() string
type Server ¶
type Server interface { generic_error.ErrorManager auth.WithAuth // Get API version. ApiVersion() string // Run server. Run(fin background_worker.Finisher) // Add operation endpoint to server. AddEndpoint(ep Endpoint, multitenancy ...bool) // Check if hateoas links are enabled. IsHateoas() bool // Get tenancy manager TenancyManager() multitenancy.Multitenancy // Check for testing mode. Testing() bool // Get dynamic tables store DynamicTables() DynamicTables // Load default server configuration from corresponding pool service SetConfigFromPoolService(service pool.PoolService, public ...bool) // Get pool service used for server configuration ConfigPoolService() pool.PoolService }
Interface of generic server that implements some API.
type ServerBaseConfig ¶
type ServerBaseConfig struct { common.WithNameBaseConfig API_VERSION string `validate:"required"` HATEOAS bool OPLOG_USER_TYPE string `default:"server_user"` DISABLE_MULTITENANCY bool }
func (*ServerBaseConfig) ApiVersion ¶
func (s *ServerBaseConfig) ApiVersion() string
func (*ServerBaseConfig) IsHateoas ¶
func (s *ServerBaseConfig) IsHateoas() bool
type Service ¶
type Service interface { generic_error.ErrorsExtender api.Resource SetSupportsMultitenancy(enable bool) SupportsMultitenancy() bool Server() Server AttachToServer(server Server) error AddDynamicTables(tables ...*DynamicTableConfig) DynamicTables() []*DynamicTableConfig }
Interface of service that implements one or more groups of API endpoints.
type ServiceBase ¶
type ServiceBase struct { api.ResourceBase generic_error.ErrorsExtenderBase // contains filtered or unexported fields }
func (*ServiceBase) AddDynamicTables ¶
func (s *ServiceBase) AddDynamicTables(tables ...*DynamicTableConfig)
func (*ServiceBase) AttachToServer ¶
func (s *ServiceBase) AttachToServer(server Server) error
func (*ServiceBase) DynamicTables ¶
func (s *ServiceBase) DynamicTables() []*DynamicTableConfig
func (*ServiceBase) Init ¶
func (s *ServiceBase) Init(pathName string, multitenancy ...bool)
func (*ServiceBase) Server ¶
func (s *ServiceBase) Server() Server
func (*ServiceBase) SetSupportsMultitenancy ¶
func (s *ServiceBase) SetSupportsMultitenancy(enable bool)
func (*ServiceBase) SupportsMultitenancy ¶
func (s *ServiceBase) SupportsMultitenancy() bool
type ServiceEachEndpointHandler ¶
type ServiceEachEndpointHandler = func(ep Endpoint)
type StatusResponse ¶
type StatusResponse struct { api.ResponseStub Status string `json:"status"` }
type StatusService ¶
type StatusService struct {
ServiceBase
}
func NewStatusService ¶
func NewStatusService(multitenancy ...bool) *StatusService
Source Files
¶
Click to show internal directories.
Click to hide internal directories.