mysql

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StmtInsertTenant and other statements for interacting with tenant table
	StmtInsertTenant            = `INSERT INTO tenant (uid, zone, priority, partition_name, name, status) VALUES (?, ?, ?, ?, ?, ?)`
	StmtGetTenant               = `` /* 271-byte string literal not displayed */
	StmtCountTenantPendingTasks = `SELECT COUNT(1) FROM usertask WHERE status = 'Pending' AND tenant_id = ? AND created_at BETWEEN ? AND ?`

	StmtInsertTask    = `` /* 133-byte string literal not displayed */
	StmtGetTask       = `` /* 137-byte string literal not displayed */
	StmtGetTaskStatus = `SELECT status FROM usertask WHERE uid = ?`

	StmtInsertResourceQuota = `INSERT INTO resourcequota (tenant_id, concurrency, cpu, custom, gpu, memory, storage, peak) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`
)

Statements

View Source
const (
	// TemplateActivateTenants and other statement templates
	TemplateActivateTenants   = `UPDATE tenant SET last_active = ? WHERE uid IN (%v)`
	TemplateFindActiveTenants = `` /* 258-byte string literal not displayed */

	TemplateFindRecentTasks  = `` /* 160-byte string literal not displayed */
	TemplateUpdateTaskStatus = `UPDATE usertask SET status = ? WHERE uid IN (%v)`
)

Statement templates NOTE: uninject language or reference here to avoid error reminders in JetBrains IDE

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQL

type MySQL struct {
	// contains filtered or unexported fields
}

func New

func New(dsn string) (*MySQL, error)

func (*MySQL) ActivateTenants

func (m *MySQL) ActivateTenants(ctx context.Context, opt types.ActivateTenantsOption) error

func (*MySQL) Close

func (m *MySQL) Close() error

func (*MySQL) CountTenantPendingTasks

func (m *MySQL) CountTenantPendingTasks(ctx context.Context, opt types.CountTenantPendingTasksOption) (int64, error)

func (*MySQL) CreateTask

func (m *MySQL) CreateTask(ctx context.Context, t entity.UserTask) error

func (*MySQL) CreateTenant

func (m *MySQL) CreateTenant(ctx context.Context, t entity.Tenant) error

func (*MySQL) FindActiveTenants

func (m *MySQL) FindActiveTenants(ctx context.Context, opt types.FindActiveTenantsOption) (ts entity.Tenants, err error)

func (*MySQL) FindRecentTasks

func (m *MySQL) FindRecentTasks(ctx context.Context, opt types.FindRecentTasksOption) (entity.Tasks, error)

func (*MySQL) GetTask

func (m *MySQL) GetTask(ctx context.Context, opt types.GetTaskOption) (entity.Tasks, error)

func (*MySQL) GetTaskStatus

func (m *MySQL) GetTaskStatus(ctx context.Context, opt types.GetTaskStatusOption) (enum.TaskStatus, error)

func (*MySQL) GetTenant

func (m *MySQL) GetTenant(ctx context.Context, opt types.GetTenantOption) (*entity.Tenant, error)

func (*MySQL) UpdateTaskStatus

func (m *MySQL) UpdateTaskStatus(ctx context.Context, opt types.UpdateTaskStatusOption) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL