Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppContext ¶
type AppContext struct {
Logger *log.Logger
RestStorage *StorageRest
FileStorage *StorageFile
Path string
}
AppContext Router Context
type Config ¶
type Config struct {
Endpoints []EndpointRestDto `json:"endpoints" yaml:"endpoints"`
Global EndpointRestDto `json:"global" yaml:"global"`
Entities []EntityRestDto `json:"entities" yaml:"entities"`
}
Config Entry point for rest config
type EndpointRestDto ¶
type EndpointRestDto struct {
ID string `json:"id" yaml:"id"`
Request RequestRestDto `json:"request" yaml:"request"`
Response ResponseRestDto `json:"response" yaml:"response"`
}
EndpointRestDto Rest Endpoint Data Transfer Object
type EntityRestDto ¶
type EntityRestDto struct {
Name string `json:"name" yaml:"name"`
Data string `json:"dataAll" yaml:"dataAll"`
NewEntity string `json:"dataNew" yaml:"dataNew"`
ID string `json:"id" yaml:"id"`
}
EntityRestDto Rest Entity Data Transfer Object
type EntityRestEntity ¶
type EntityRestEntity struct {
Config EntityRestDto
SequenceNumber int
}
EntityRestEntity EntityRestEntity
type File ¶
type File struct {
ID string `json:"id" yaml:"id"`
Name string `json:"name" yaml:"name"`
Length int `json:"length" yaml:"length"`
}
File File structure
type RequestRestDto ¶
type RequestRestDto struct {
Method string `json:"method" yaml:"method"`
Path string `json:"path" yaml:"path"`
PathReg string `json:"pathReg" yaml:"pathReg"`
Headers map[string]string `json:"headers" yaml:"headers"`
}
RequestRestDto Rest Request Data Transfer Object
type ResponseRestDto ¶
type ResponseRestDto struct {
Body string `json:"body" yaml:"body"`
BodyFile string `json:"bodyFile" yaml:"bodyFile"`
Status int `json:"status" yaml:"status"`
Headers map[string]string `json:"headers" yaml:"headers"`
}
ResponseRestDto Rest Response Data Transfer Object
type StorageFile ¶
type StorageFile interface {
Add(name string, data []byte) File
Get(id string) (File, error)
Put(id string, name string, data []byte) File
Delete(id string) error
DeleteAll()
GetAll() []File
Size() int
IsExist(id string) bool
GetBody(id string) ([]byte, error)
}
StorageFile File Repository
type StorageRest ¶
type StorageRest interface {
Add(config EndpointRestDto) EndpointRestDto
Get(id string) (EndpointRestDto, error)
Put(id string, config EndpointRestDto) (EndpointRestDto, error)
Delete(id string) error
DeleteAll()
GetAll() []EndpointRestDto
FindByRequest(r *http.Request, c AppContext) (EndpointRestDto, error)
Size() int
AddGlobal(config EndpointRestDto) EndpointRestDto
GetGlobal() EndpointRestDto
DeleteGlobal()
StorageRestEntity
}
StorageRest Rest Repository
type StorageRestEntity ¶
type StorageRestEntity interface {
AddEntity(config EntityRestDto) EntityRestDto
GetEntity(name string) (EntityRestDto, error)
PutEntity(name string, config EntityRestDto) (EntityRestDto, error)
DeleteEntity(name string) error
DeleteAllEntities()
GetAllEntities() []EntityRestDto
SizeEntities() int
FindEntityByRequest(r *http.Request, c AppContext) (EndpointRestDto, error)
}
StorageRestEntity Rest Entity Repository
Click to show internal directories.
Click to hide internal directories.