Documentation
¶
Index ¶
Constants ¶
View Source
const ( StatusUnknown = iota StatusCreated StatusRunning StatusFinished StatusStopped StatusError )
Variables ¶
View Source
var ( // ErrNotFound returns when request record not found in db ErrNotFound = errors.New("record not found") )
Functions ¶
func DbIntoGin ¶
func DbIntoGin(db *DB) gin.HandlerFunc
DbIntoGin inspired from `https://gqlgen.com/recipes/gin/#accessing-gincontext`
func NewNotFoundErr ¶
NewNotFoundErr wrap not found error with specific msg
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func DBFromGin ¶
DBFromGin inspired from `https://gqlgen.com/recipes/gin/#accessing-gincontext`
func (*DB) DeleteTask ¶
DeleteTask delete a task by given ID from DB
type Endpoint ¶
type Endpoint struct {
Type ServiceType `json:"type"`
Path string `json:"path"`
Options interface{} `json:"options,omitempty"`
}
Endpoint contains info to create an endpoint
type ServiceType ¶
type ServiceType string
func (ServiceType) MarshalGQL ¶
func (st ServiceType) MarshalGQL(w io.Writer)
func (*ServiceType) Parse ¶
func (st *ServiceType) Parse(t string)
Parse type string into ServiceType
func (ServiceType) String ¶
func (st ServiceType) String() string
String implement Stringer for ServiceType
func (*ServiceType) UnmarshalGQL ¶
func (st *ServiceType) UnmarshalGQL(v interface{}) error
type Task ¶
type Task struct {
ID string `json:"id"`
Name string `json:"name"`
Type TaskType `json:"type"`
Status TaskStatus `json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Src Endpoint `json:"src"`
Dst Endpoint `json:"dst"`
Options map[string]interface{} `json:"options,omitempty"`
}
Task contains info of data migration task
type TaskStatus ¶
type TaskStatus int
TaskStatus represent status of task
func (*TaskStatus) IsRunning ¶
func (ts *TaskStatus) IsRunning() bool
IsRunning assert whether task status is running
func (TaskStatus) MarshalGQL ¶
func (ts TaskStatus) MarshalGQL(w io.Writer)
func (*TaskStatus) Parse ¶
func (ts *TaskStatus) Parse(status string)
Parse status string into TaskStatus
func (TaskStatus) String ¶
func (ts TaskStatus) String() string
String implement Stringer for TaskStatus
func (*TaskStatus) UnmarshalGQL ¶
func (ts *TaskStatus) UnmarshalGQL(v interface{}) error
Click to show internal directories.
Click to hide internal directories.