db

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const DriverName = "sqlite3"

DriverName is the default driver name for SQLite.

Variables

View Source
var (
	// ErrRecordNotFound - Record not found error
	ErrRecordNotFound = gorm.ErrRecordNotFound
	Client            *gorm.DB
)

Client - Database Client

Functions

func AddCertificate added in v0.0.2

func AddCertificate(caType int, keyType string, commonName string, cert []byte, key []byte) error

AddCertificate add a certificate to the database

func AddContent

func AddContent(pbWebContent *clientpb.WebContent, webContentDir string) (*clientpb.WebContent, error)

AddContent - Add content to website

func AddFile added in v0.0.3

func AddFile(typ string, taskpb *clientpb.Task, td *models.FileDescription) error

func AddTask

func AddTask(task *clientpb.Task) error

func AddWebsite added in v0.0.3

func AddWebsite(webSiteName string, webContentDir string) (*clientpb.Website, error)

AddWebsite - Return website, create if it does not exist

func CreateOperator

func CreateOperator(name string, typ string, remoteAddr string) error

func CreatePipeline added in v0.0.2

func CreatePipeline(pipeline *models.Pipeline) error

func DeleteAllCertificates

func DeleteAllCertificates() error

DeleteAllCertificates

func DeleteCertificate

func DeleteCertificate(name string) error

DeleteCertificate

func DeleteSession

func DeleteSession(sessionID string) error

Basic Session OP

func DisablePipeline added in v0.0.3

func DisablePipeline(pipeline models.Pipeline) error

func EnablePipeline added in v0.0.3

func EnablePipeline(pipeline models.Pipeline) error

func FindAliveSessions

func FindAliveSessions() ([]*clientpb.Session, error)

func FindAllSessions

func FindAllSessions() (*clientpb.Sessions, error)

func FindFilesWithNonOneCurTotal added in v0.0.3

func FindFilesWithNonOneCurTotal(session models.Session) ([]models.File, error)

func FindPipeline added in v0.0.2

func FindPipeline(name string) (models.Pipeline, error)

func FindPipelineCert added in v0.0.3

func FindPipelineCert(pipelineName, listenerID string) (string, string, error)

func FindSession

func FindSession(sessionID string) (*clientpb.Session, error)

func FindTaskAndMaxTasksID

func FindTaskAndMaxTasksID(sessionID string) ([]*models.Task, uint32, error)

func GetAllFiles added in v0.0.3

func GetAllFiles(sessionID string) ([]models.File, error)

File

func GetAllTask added in v0.0.3

func GetAllTask() (*clientpb.Tasks, error)

func GetArtifactById added in v0.0.3

func GetArtifactById(id uint32) (*models.Builder, error)

func GetArtifactByName added in v0.0.3

func GetArtifactByName(name string) (*models.Builder, error)

func GetArtifacts added in v0.0.3

func GetArtifacts() (*clientpb.Builders, error)

func GetProfile added in v0.0.3

func GetProfile(name string) (*types.ProfileConfig, error)

func GetProfiles added in v0.0.3

func GetProfiles() ([]models.Profile, error)

func GetTaskDescriptionByID

func GetTaskDescriptionByID(taskID string) (*models.FileDescription, error)

func GetTaskPB added in v0.0.3

func GetTaskPB(taskID string) (*clientpb.Task, error)

func HasOperator added in v0.0.2

func HasOperator(typ string) (bool, error)

func ListClients added in v0.0.2

func ListClients() ([]models.Operator, error)

func ListListeners

func ListListeners() ([]models.Operator, error)

func ListPipelines added in v0.0.2

func ListPipelines(listenerID string) ([]models.Pipeline, error)

func ListWebsite added in v0.0.3

func ListWebsite(listenerID string) ([]models.Pipeline, error)

func NewDBClient

func NewDBClient() *gorm.DB

newDBClient - Initialize the db client

func NewProfile added in v0.0.3

func NewProfile(profile *clientpb.Profile) error

generator

func Open

func Open(dsn string) gorm.Dialector

func RemoveContent

func RemoveContent(id string) error

RemoveContent - Remove content by ID

func RemoveWebsite added in v0.0.3

func RemoveWebsite(id string) error

RemoveWebsite - Remove website by ID

func RemoveWebsiteContent added in v0.0.3

func RemoveWebsiteContent(id string) error

RemoveWebsiteContent - Remove all content of a website by ID

func SaveArtifact added in v0.0.3

func SaveArtifact(name, artifactType, platform, arch, stage string) (*models.Builder, error)

func SaveArtifactFromGenerate added in v0.0.3

func SaveArtifactFromGenerate(req *clientpb.Generate, realName, path string) (*models.Builder, error)

func SaveCertificate

func SaveCertificate(certificate *models.Certificate) error

func Session

func Session() *gorm.DB

Session - Database session

func UpdateDownloadTotal added in v0.0.3

func UpdateDownloadTotal(task *clientpb.Task, total int) error

func UpdateFileByID added in v0.0.3

func UpdateFileByID(ID string, newCur int) error

func UpdateGeneratorConfig added in v0.0.3

func UpdateGeneratorConfig(req *clientpb.Generate, path string, config *types.ProfileConfig) error

UpdateGeneratorConfig - Update the generator config

func UpdateLast

func UpdateLast(sessionID string) error

func UpdateSession

func UpdateSession(sessionID, note, group string) error

func UpdateTask

func UpdateTask(task *clientpb.Task) error

func UpdateTaskDescription added in v0.0.3

func UpdateTaskDescription(taskID, Description string) error

func WebContentByIDAndPath

func WebContentByIDAndPath(id string, path string, webContentDir string, eager bool) (*clientpb.WebContent, error)

WebContent by ID and path

func WebsiteByName

func WebsiteByName(name string, webContentDir string) (*clientpb.Website, error)

WebsiteByName - Get website by name

func Websites

func Websites(webContentDir string) ([]*clientpb.Website, error)

Websites - Return all websites

func WebsitesAllByname added in v0.0.3

func WebsitesAllByname(name, webContentDir string) ([]*clientpb.Website, error)

Types

type Dialector

type Dialector struct {
	DriverName string
	DSN        string
	Conn       gorm.ConnPool
}

func (Dialector) BindVarTo

func (dialector Dialector) BindVarTo(writer clause.Writer, stmt *gorm.Statement, v interface{})

func (Dialector) ClauseBuilders

func (dialector Dialector) ClauseBuilders() map[string]clause.ClauseBuilder

func (Dialector) DataTypeOf

func (dialector Dialector) DataTypeOf(field *schema.Field) string

func (Dialector) DefaultValueOf

func (dialector Dialector) DefaultValueOf(field *schema.Field) clause.Expression

func (Dialector) Explain

func (dialector Dialector) Explain(sql string, vars ...interface{}) string

func (Dialector) Initialize

func (dialector Dialector) Initialize(db *gorm.DB) (err error)

func (Dialector) Migrator

func (dialector Dialector) Migrator(db *gorm.DB) gorm.Migrator

func (Dialector) Name

func (dialector Dialector) Name() string

func (Dialector) QuoteTo

func (dialector Dialector) QuoteTo(writer clause.Writer, str string)

func (Dialector) RollbackTo

func (dialectopr Dialector) RollbackTo(tx *gorm.DB, name string) error

func (Dialector) SavePoint

func (dialectopr Dialector) SavePoint(tx *gorm.DB, name string) error

type Migrator

type Migrator struct {
	migrator.Migrator
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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