dao

package
Version: v1.8.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddExecution

func AddExecution(execution *models.Execution) (int64, error)

AddExecution ...

func AddRegistry

func AddRegistry(registry *models.Registry) (int64, error)

AddRegistry add a new registry

func AddRepPolicy

func AddRepPolicy(policy *models.RepPolicy) (int64, error)

AddRepPolicy insert new policy to DB.

func AddTask

func AddTask(task *models.Task) (int64, error)

AddTask ...

func DeleteAllExecutions

func DeleteAllExecutions(policyID int64) error

DeleteAllExecutions ...

func DeleteAllTasks

func DeleteAllTasks(executionID int64) error

DeleteAllTasks ...

func DeleteExecution

func DeleteExecution(id int64) error

DeleteExecution ...

func DeleteRegistry

func DeleteRegistry(id int64) error

DeleteRegistry deletes a registry

func DeleteRepPolicy

func DeleteRepPolicy(id int64) error

DeleteRepPolicy will hard delete database item

func DeleteTask

func DeleteTask(id int64) error

DeleteTask ...

func GetExecution

func GetExecution(id int64) (*models.Execution, error)

GetExecution ...

func GetExecutions

func GetExecutions(query ...*models.ExecutionQuery) ([]*models.Execution, error)

GetExecutions ...

func GetPolicies

func GetPolicies(queries ...*model.PolicyQuery) (int64, []*models.RepPolicy, error)

GetPolicies list polices with given query parameters.

func GetRegistry

func GetRegistry(id int64) (*models.Registry, error)

GetRegistry gets one registry from database by id.

func GetRegistryByName

func GetRegistryByName(name string) (*models.Registry, error)

GetRegistryByName gets one registry from database by its name.

func GetRegistryByURL

func GetRegistryByURL(url string) (*models.Registry, error)

GetRegistryByURL gets one registry from database by its URL.

func GetRepPolicy

func GetRepPolicy(id int64) (policy *models.RepPolicy, err error)

GetRepPolicy return special policy by id.

func GetRepPolicyByName

func GetRepPolicyByName(name string) (policy *models.RepPolicy, err error)

GetRepPolicyByName return special policy by name.

func GetTask

func GetTask(id int64) (*models.Task, error)

GetTask ...

func GetTasks

func GetTasks(query ...*models.TaskQuery) ([]*models.Task, error)

GetTasks ...

func GetTotalOfExecutions

func GetTotalOfExecutions(query ...*models.ExecutionQuery) (int64, error)

GetTotalOfExecutions returns the total count of replication execution

func GetTotalOfTasks

func GetTotalOfTasks(query ...*models.TaskQuery) (int64, error)

GetTotalOfTasks ...

func ListRegistries

func ListRegistries(query ...*ListRegistryQuery) (int64, []*models.Registry, error)

ListRegistries lists registries. Registries returned are sorted by creation time. - query: query to the registry name, name query and pagination are defined.

func UpdateExecution

func UpdateExecution(execution *models.Execution, props ...string) (int64, error)

UpdateExecution ...

func UpdateRegistry

func UpdateRegistry(registry *models.Registry, props ...string) error

UpdateRegistry updates one registry

func UpdateRepPolicy

func UpdateRepPolicy(policy *models.RepPolicy, props ...string) (err error)

UpdateRepPolicy update fields by props

func UpdateTask

func UpdateTask(task *models.Task, props ...string) (int64, error)

UpdateTask ...

func UpdateTaskStatus

func UpdateTaskStatus(id int64, status string, statusCondition ...string) (int64, error)

UpdateTaskStatus updates the status of task. The implementation uses raw sql rather than QuerySetter.Filter... as QuerySetter will generate sql like:

`UPDATE "replication_task" SET "end_time" = $1, "status" = $2
  WHERE "id" IN ( SELECT T0."id" FROM "replication_task" T0 WHERE T0."id" = $3
  AND T0."status" IN ($4, $5, $6))]`

which is not a "single" sql statement, this will cause issues when running in concurrency

Types

type ListRegistryQuery

type ListRegistryQuery struct {
	// Query is name query
	Query string
	// Offset specifies the offset in the registry list to return
	Offset int64
	// Limit specifies the maximum registries to return
	Limit int64
}

ListRegistryQuery defines the query conditions to list registry.

type ScheduleJobDAO

type ScheduleJobDAO interface {
	Add(*models.ScheduleJob) (int64, error)
	Get(int64) (*models.ScheduleJob, error)
	Update(*models.ScheduleJob, ...string) error
	Delete(int64) error
	List(...*models.ScheduleJobQuery) ([]*models.ScheduleJob, error)
}

ScheduleJobDAO ...

var ScheduleJob ScheduleJobDAO = &scheduleJobDAO{}

ScheduleJob is the DAO for schedule job

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL