models

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DBTYPE_POSTGRES = "POSTGRES"
	DBTYPE_MONGO    = "MONGO"

	DBUSESSH_NONE        = "NONE"
	DBUSESSH_PASSWORD    = "PASSWORD"
	DBUSESSH_KEYFILE     = "KEYFILE"
	DBUSESSH_PASSKEYFILE = "PASSKEYFILE"

	DBLOGINTYPE_ROOT = "USE_ROOT"
)
View Source
const (
	SETTING_NAME_APP_ID            = "APP_ID"
	SETTING_NAME_TELEMETRY_ENABLED = "TELEMETRY_ENABLED"
	SETTING_NAME_LOGS_EXPIRE       = "LOGS_EXPIRE"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DBConnection

type DBConnection struct {
	ID          string            `gorm:"type:uuid;primaryKey"`
	Name        string            `gorm:"not null;uniqueIndex"`
	ProjectID   string            `gorm:"not null"`
	Type        string            `gorm:"not null"`
	DBScheme    sbsql.CryptedData `gorm:"type:text"`
	DBHost      sbsql.CryptedData `gorm:"type:text"`
	DBPort      sbsql.CryptedData `gorm:"type:text"`
	DBName      sbsql.CryptedData `gorm:"type:text"`
	DBUser      sbsql.CryptedData `gorm:"type:text"`
	DBPassword  sbsql.CryptedData `gorm:"type:text"`
	LoginType   string            `gorm:"not null;default:USE_ROOT;"`
	UseSSH      string            `gorm:"not null"`
	SSHHost     sbsql.CryptedData `gorm:"type:text"`
	SSHUser     sbsql.CryptedData `gorm:"type:text"`
	SSHPassword sbsql.CryptedData `gorm:"type:text"`
	SSHKeyFile  sbsql.CryptedData `gorm:"type:text"`
	CreatedAt   time.Time         `gorm:"autoCreateTime"`
	UpdatedAt   time.Time         `gorm:"autoUpdateTime"`

	Project Project `gorm:"foreignkey:ProjectID"`
}

func NewDBConnection

func NewDBConnection(projectID string, name string, dbtype string, dbscheme, dbhost, dbport, dbuser, dbpassword, databaseName, useSSH, sshHost, sshUser, sshPassword, sshKeyFile string) (*DBConnection, error)

func (DBConnection) Save

func (dbConn DBConnection) Save() error

type DBQuery

type DBQuery struct {
	ID             string    `gorm:"type:uuid;primaryKey"`
	Name           string    `gorm:"not null"`
	Query          string    `gorm:"not null"`
	DBConnectionID string    `gorm:"type:uuid;not null"`
	CreatedAt      time.Time `gorm:"autoCreateTime"`
	UpdatedAt      time.Time `gorm:"autoUpdateTime"`

	DBConnection DBConnection `gorm:"foreignkey:db_connection_id"`
}

func NewQuery

func NewQuery(name string, query string, dbConnectionID string) *DBQuery

type DBQueryLog

type DBQueryLog struct {
	ID             string    `gorm:"type:uuid;primaryKey"`
	Query          string    `gorm:"not null"`
	DBConnectionID string    `gorm:"type:uuid;not null"`
	CreatedAt      time.Time `gorm:"autoCreateTime"`
	UpdatedAt      time.Time `gorm:"autoUpdateTime"`
}

func NewQueryLog

func NewQueryLog(dbConnectionID string, query string) *DBQueryLog

type Project

type Project struct {
	ID        string    `gorm:"type:uuid;primaryKey"`
	Name      string    `gorm:"not null"`
	CreatedAt time.Time `gorm:"autoCreateTime"`
	UpdatedAt time.Time `gorm:"autoUpdateTime"`
}

func NewProject

func NewProject(name string) *Project

type Setting

type Setting struct {
	Name  string `gorm:"primaryKey"`
	Value string `gorm:"not null"`
}

func NewSetting

func NewSetting(name string, value string) *Setting

func (*Setting) Bool

func (s *Setting) Bool() bool

func (*Setting) Int

func (s *Setting) Int() int

func (*Setting) UUID

func (s *Setting) UUID() uuid.UUID

Jump to

Keyboard shortcuts

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