db

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TableMSPTenant  = "msp_tenant"
	TableMSPProject = "msp_project"
)
View Source
const (
	MYSQL = "mysql"
)

Variables

This section is empty.

Functions

func MockInit added in v1.2.2

func MockInit(dialect string) (*gorm.DB, sqlmock.Sqlmock, error)

Types

type DB added in v1.2.0

type DB struct {
	*gorm.DB
	MspTenant  MSPTenantDB
	MspProject MSPProjectDB
}

func New added in v1.2.0

func New(db *gorm.DB) *DB

func (*DB) Begin added in v1.2.0

func (db *DB) Begin() *DB

type MSPProject added in v1.2.0

type MSPProject struct {
	Id          string    `gorm:"column:id" db:"id" json:"id" form:"id"`                                         // MSP project ID
	Name        string    `gorm:"column:name" db:"name" json:"name" form:"name"`                                 // MSP project name
	DisplayName string    `gorm:"column:display_name" db:"display_name" json:"display_name" form:"display_name"` // MSP project display name
	Type        string    `gorm:"column:type" db:"type" json:"type" form:"type"`                                 // MSP project type
	CreatedAt   time.Time `gorm:"column:created_at" db:"created_at" json:"created_at" form:"created_at"`         // Create time
	UpdatedAt   time.Time `gorm:"column:updated_at" db:"updated_at" json:"updated_at" form:"updated_at"`         // Update time
	IsDeleted   bool      `gorm:"column:is_deleted" db:"is_deleted" json:"is_deleted" form:"is_deleted"`         // Deleted or not
}

MSPProject TODO remove msp project table

func (MSPProject) TableName added in v1.2.0

func (MSPProject) TableName() string

type MSPProjectDB added in v1.2.0

type MSPProjectDB struct {
	*gorm.DB
}

MSPProjectDB msp_project

func (*MSPProjectDB) Create added in v1.2.0

func (db *MSPProjectDB) Create(project *MSPProject) (*MSPProject, error)

func (*MSPProjectDB) Delete added in v1.2.0

func (db *MSPProjectDB) Delete(id string) (*MSPProject, error)

func (*MSPProjectDB) Query added in v1.2.0

func (db *MSPProjectDB) Query(id string) (*MSPProject, error)

func (*MSPProjectDB) Update added in v1.2.0

func (db *MSPProjectDB) Update(project *MSPProject) (*MSPProject, error)

type MSPTenant

type MSPTenant struct {
	Id               string    `gorm:"column:id" db:"id" json:"id" form:"id"`                                                                 // Tenant id
	Type             string    `gorm:"column:type" db:"type" json:"type" form:"type"`                                                         // Tenant type(dop 、msp)
	RelatedProjectId string    `gorm:"column:related_project_id" db:"related_project_id" json:"related_project_id" form:"related_project_id"` // Project id
	RelatedWorkspace string    `gorm:"column:related_workspace" db:"related_workspace" json:"related_workspace" form:"related_workspace"`     // Workspace( DEV、TEST、STAGING、PROD、DEFAULT)
	CreatedAt        time.Time `gorm:"column:created_at" db:"created_at" json:"create_time" form:"create_time"`                               // Create time
	UpdatedAt        time.Time `gorm:"column:updated_at" db:"updated_at" json:"update_time" form:"update_time"`                               // Update time
	IsDeleted        bool      `gorm:"column:is_deleted" db:"is_deleted" json:"is_deleted" form:"is_deleted"`                                 // Delete or not
}

func (MSPTenant) TableName

func (MSPTenant) TableName() string

type MSPTenantDB

type MSPTenantDB struct {
	*gorm.DB
}

MSPTenantDB msp_tenant

func (*MSPTenantDB) DeleteTenantByTenantID added in v1.2.0

func (db *MSPTenantDB) DeleteTenantByTenantID(tenantId string) (*MSPTenant, error)

func (*MSPTenantDB) InsertTenant

func (db *MSPTenantDB) InsertTenant(tenant *MSPTenant) (*MSPTenant, error)

func (*MSPTenantDB) QueryTenant

func (db *MSPTenantDB) QueryTenant(tenantID string) (*MSPTenant, error)

func (*MSPTenantDB) QueryTenantByProjectID added in v1.2.0

func (db *MSPTenantDB) QueryTenantByProjectID(projectID string) ([]*MSPTenant, error)

func (*MSPTenantDB) QueryTenantByProjectIDAndWorkspace added in v1.2.0

func (db *MSPTenantDB) QueryTenantByProjectIDAndWorkspace(projectID, workspace string) (*MSPTenant, error)

Jump to

Keyboard shortcuts

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