dbclient

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

package dbclient defines operations about database

Index

Constants

View Source
const DistinctAssetIDFromAccess = `` /* 191-byte string literal not displayed */
View Source
const SelectFoundRows = `
SELECT FOUND_ROWS()
`

Variables

This section is empty.

Functions

func CheckVersionConflict

func CheckVersionConflict(orgID uint64, assetID string, major, minor, patch uint64) (result [][3]uint64, ok bool, err error)

CheckVersionConflict checks out all versions of the major, determines if there is a version number conflict. ok is true means no conflict.

func Close

func Close() error

func CreateOrUpdateAPIAssetVersionSpec

func CreateOrUpdateAPIAssetVersionSpec(spec *APIAssetVersionSpecsModel) error

func DeleteAPIAssetByOrgAssetID

func DeleteAPIAssetByOrgAssetID(orgID uint64, assetID string, cascade bool) error

DeleteAPIAssetByOrgAssetID deletes the APIAsset and APIAssetVersion record for giving assetID

func DeleteAPIAssetVersion

func DeleteAPIAssetVersion(orgID uint64, assetID string, versionID uint64, cascade bool) error

DeleteAPIAssetVersion deletes a APIAssetVersion record

func FirstOrCreateInstantiation

func FirstOrCreateInstantiation(model *apistructs.InstantiationModel, params map[string]interface{}) error

func GenSemVer

func GenSemVer(orgID uint64, assetID, swaggerVersion string, major, minor, patch *uint64) error

GenSemVer generate the semantics version

func GetMyClient

func GetMyClient(req *apistructs.GetClientReq, orgManager bool) (*apistructs.ClientModel, error)

GetMyClient select a Client details

func ListAccess

func ListAccess(req *apistructs.ListAccessReq, responsibleAssetIDs []string) (uint64, []*apistructs.ListAccessObj, error)

func ListMyClients

func ListMyClients(req *apistructs.ListMyClientsReq, orgManager bool) (total uint64, models []*apistructs.ClientModel, err error)

func OneInstantiation

func OneInstantiation(model *apistructs.InstantiationModel, params map[string]interface{}) error

func Open

func Open() error

func QueryAPILatestVersion

func QueryAPILatestVersion(orgID uint64, assetID string) (*apistructs.APIAssetVersionsModel, error)

func QuerySpecsFromVersions

func QuerySpecsFromVersions(orgID uint64, assetID string, versionIDs []string, m map[uint64]*apistructs.PagingAPIAssetVersionRspObj) error

func QueryVersionLatestSpec

func QueryVersionLatestSpec(orgID, versionID uint64) (*apistructs.APIAssetVersionSpecsModel, error)

func Sq

func Sq() *gorm.DB

func UpdateInstantiation

func UpdateInstantiation(req *apistructs.UpdateInstantiationReq) error

Types

type APIAssetVersionSpecsModel

type APIAssetVersionSpecsModel apistructs.APIAssetVersionSpecsModel

APIAssetVersionSpec is dice_api_asset_version_specs model

func (APIAssetVersionSpecsModel) TableName

func (m APIAssetVersionSpecsModel) TableName() string

type APIAssetsModel

type APIAssetsModel apistructs.APIAssetsModel

APIAsset is dice_api_assets model

func GetAPIAsset

func GetAPIAsset(req *apistructs.GetAPIAssetReq) (*APIAssetsModel, error)

func (APIAssetsModel) TableName

func (APIAssetsModel) TableName() string

type APITestEnv

type APITestEnv struct {
	ID        int64     `xorm:"pk autoincr" json:"id"`
	CreatedAt time.Time `xorm:"created" json:"createdAt"`
	UpdatedAt time.Time `xorm:"updated" json:"updatedAt"`

	EnvID   int64  `xorm:"env_id" json:"envID"`
	EnvType string `xorm:"env_type" json:"envType"`
	Name    string `xorm:"name" json:"name"`
	Domain  string `xorm:"domain" json:"domain"`
	Header  string `xorm:"header" json:"header"`
	Global  string `xorm:"global" json:"global"`
}

APITestEnv maintains envs about API

func GetTestEnv

func GetTestEnv(envID int64) (*APITestEnv, error)

func GetTestEnvListByEnvID

func GetTestEnvListByEnvID(envID int64, envType string) ([]APITestEnv, error)

type DBClient

type DBClient struct {
	*dbengine.DBEngine
}
var DB *DBClient

func (*DBClient) Sq

func (db *DBClient) Sq() *gorm.DB

func (*DBClient) Tx

func (db *DBClient) Tx() *TX

type TX

type TX struct {
	*gorm.DB
}

func Tx

func Tx() *TX

func (*TX) Sq

func (tx *TX) Sq() *gorm.DB

Jump to

Keyboard shortcuts

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