Documentation ¶
Index ¶
- Variables
- func Bind(r bunrouter.Request, ans any) error
- func JSON(w http.ResponseWriter, statusCode int, value interface{}) error
- func New(cfg ServerConfig) (*server, error)
- func NewRouter(cfg RouterConfig) *bunrouter.Router
- func ToScheduledJob(p ScheduledJobsPayload) entities.ScheduledJob
- type AuthService
- type ExecutionResponse
- type HTTPError
- type HealthHandler
- type HealthResponse
- type MetaHandler
- type MetaResponse
- type NotFoundError
- type RegisterPayload
- type RegisterResponse
- type ResponseWriter
- type RouterConfig
- type ScheduledJobGetResponse
- type ScheduledJobResponse
- type ScheduledJobService
- type ScheduledJobsHandler
- type ScheduledJobsPayload
- type ServerConfig
- type SignupPayload
- type SignupResponse
- type UserHandler
- type ValidationError
- type WorkerHandler
- type WorkerService
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("resource not found")
Functions ¶
func New ¶
func New(cfg ServerConfig) (*server, error)
func NewRouter ¶
func NewRouter(cfg RouterConfig) *bunrouter.Router
func ToScheduledJob ¶
func ToScheduledJob(p ScheduledJobsPayload) entities.ScheduledJob
Types ¶
type AuthService ¶
type AuthService interface { Signup(ctx context.Context, username string) (string, error) AuthMiddleware(next bunrouter.HandlerFunc) bunrouter.HandlerFunc InternalApi(next bunrouter.HandlerFunc) bunrouter.HandlerFunc }
type ExecutionResponse ¶
type HTTPError ¶
func NewHTTPError ¶
type HealthHandler ¶
type HealthHandler struct {
// contains filtered or unexported fields
}
func (*HealthHandler) Get ¶
func (h *HealthHandler) Get(w http.ResponseWriter, r bunrouter.Request) error
type HealthResponse ¶
type MetaHandler ¶
type MetaHandler struct {
// contains filtered or unexported fields
}
func (*MetaHandler) Get ¶
func (h *MetaHandler) Get(w http.ResponseWriter, r bunrouter.Request) error
type MetaResponse ¶
type MetaResponse struct {
PublicKey string `json:"publicKey"`
}
type NotFoundError ¶
type NotFoundError struct {
Message string
}
func (NotFoundError) Error ¶
func (e NotFoundError) Error() string
type RegisterPayload ¶
type RegisterPayload struct {
Name string `json:"name"`
}
type RegisterResponse ¶
type RegisterResponse struct {
Partition int `json:"partition"`
}
type ResponseWriter ¶
type ResponseWriter struct { Wrapped http.ResponseWriter // contains filtered or unexported fields }
func NewResponseWriter ¶
func NewResponseWriter(w http.ResponseWriter) *ResponseWriter
func (*ResponseWriter) StatusCode ¶
func (w *ResponseWriter) StatusCode() int
type RouterConfig ¶
type RouterConfig struct { Log zerolog.Logger ScheduledJobSrv ScheduledJobService WorkerSrv WorkerService AuthSrv AuthService PublicKey *ecdsa.PublicKey }
type ScheduledJobGetResponse ¶
type ScheduledJobResponse ¶
type ScheduledJobResponse struct {
UUID string `json:"uuid"`
}
type ScheduledJobService ¶
type ScheduledJobsHandler ¶
type ScheduledJobsHandler struct {
// contains filtered or unexported fields
}
func (*ScheduledJobsHandler) Create ¶
func (h *ScheduledJobsHandler) Create(w http.ResponseWriter, r bunrouter.Request) error
func (*ScheduledJobsHandler) Get ¶
func (h *ScheduledJobsHandler) Get(w http.ResponseWriter, r bunrouter.Request) error
type ScheduledJobsPayload ¶
type ScheduledJobsPayload struct { Name string `json:"name"` Description string `json:"description"` Url string `json:"url"` Payload string `json:"payload"` ContentType string `json:"contentType"` Signature string `json:"signature"` RunAt time.Time `json:"runAt"` Retries int `json:"retries"` }
TODO validate
func (ScheduledJobsPayload) Validate ¶
func (s ScheduledJobsPayload) Validate() error
type ServerConfig ¶
type SignupPayload ¶
type SignupPayload struct {
Username string
}
func (SignupPayload) Validate ¶
func (o SignupPayload) Validate() error
type SignupResponse ¶
type SignupResponse struct {
Apikey string `json:"apiKey"`
}
type UserHandler ¶
type UserHandler struct {
// contains filtered or unexported fields
}
func (*UserHandler) Create ¶
func (h *UserHandler) Create(w http.ResponseWriter, r bunrouter.Request) error
type ValidationError ¶
type ValidationError struct {
Message string
}
func (ValidationError) Error ¶
func (e ValidationError) Error() string
type WorkerHandler ¶
type WorkerHandler struct {
// contains filtered or unexported fields
}
func (*WorkerHandler) HealthHandler ¶
func (h *WorkerHandler) HealthHandler(w http.ResponseWriter, r bunrouter.Request) error
func (*WorkerHandler) Register ¶
func (h *WorkerHandler) Register(w http.ResponseWriter, r bunrouter.Request) error
func (*WorkerHandler) UnRegister ¶
func (h *WorkerHandler) UnRegister(w http.ResponseWriter, r bunrouter.Request) error
type WorkerService ¶
type WorkerService interface { Register(ctx context.Context, name string) (entities.WorkerMeta, error) UnRegister(ctx context.Context, name string) (entities.WorkerMeta, error) Health(ctx context.Context, name string) error UpSince(ctx context.Context) time.Time ActiveWorkers(ctx context.Context) int DbOk(ctx context.Context) bool }
Click to show internal directories.
Click to hide internal directories.