db

package
v0.0.0-...-7c37063 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

func FilterTimelineByDate

func FilterTimelineByDate(db *gorm.DB, start_date string, end_date string) *gorm.DB

func OpenPostgresDB

func OpenPostgresDB(cfg *config.Config) (*sql.DB, error)

Types

type DBConnector

type DBConnector interface {
	CreateServiceTableEntry(s *models.Services) error
	UpdateServiceTableEntry(name string, s config.Service) (service models.Services, err error)
	DeleteServiceTableEntry(name string) (models.Services, error)
	GetServicesAll(offset int, limit int, q structs.Query) ([]structs.ExpandedServicesData, int64, error)
	GetLatest(service structs.ExpandedServicesData) (structs.ExpandedServicesData, error, error)
	GetServiceByID(id int) (models.Services, int64, error)
	GetServiceByName(name string) (models.Services, int64, error)
	GetServiceByRepo(repo string) (models.Services, error)

	CreateProjectTableEntry(p *models.Projects) error
	UpdateProjectTableEntry(p *models.Projects) error
	GetProjectsAll(offset int, limit int, q structs.Query) ([]models.Projects, int64, error)
	GetProjectsByService(service models.Services, offset int, limit int, q structs.Query) ([]models.Projects, int64, error)
	GetProjectByID(id int) (models.Projects, int64, error)
	GetProjectByName(name string) (models.Projects, int64, error)
	GetProjectByRepo(repo string) (models.Projects, error)

	GetTimelinesAll(offset int, limit int, q structs.Query) ([]models.Timelines, int64, error)
	GetTimelinesByService(service models.Services, offset int, limit int, q structs.Query) ([]models.Timelines, int64, error)
	GetTimelinesByProject(project models.Projects, offset int, limit int, q structs.Query) ([]models.Timelines, int64, error)
	GetTimelineByRef(ref string) (models.Timelines, int64, error)
	DeleteTimelinesByService(service models.Services) error

	CreateCommitEntry(timeline models.Timelines) error
	BulkCreateCommitEntry(timeline []models.Timelines) error
	GetCommitsAll(offset int, limit int, q structs.Query) ([]models.Timelines, int64, error)
	GetCommitsByService(service models.Services, offset int, limit int, q structs.Query) ([]models.Timelines, int64, error)
	GetCommitsByProject(project models.Projects, offset int, limit int, q structs.Query) ([]models.Timelines, int64, error)
	GetCommitByRef(ref string) (models.Timelines, int64, error)

	CreateDeployEntry(timeline models.Timelines) error
	GetDeploysAll(offset int, limit int, q structs.Query) ([]models.Timelines, int64, error)
	GetDeploysByService(service models.Services, offset int, limit int, q structs.Query) ([]models.Timelines, int64, error)
	GetDeploysByProject(project models.Projects, offset int, limit int, q structs.Query) ([]models.Timelines, int64, error)
	GetDeployByRef(ref string) (models.Timelines, int64, error)
}

type DBConnectorImpl

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

func NewDBConnector

func NewDBConnector(cfg *config.Config) *DBConnectorImpl

func SetDBConnector

func SetDBConnector(db *gorm.DB) *DBConnectorImpl

func (*DBConnectorImpl) BulkCreateCommitEntry

func (conn *DBConnectorImpl) BulkCreateCommitEntry(t []models.Timelines) error

func (*DBConnectorImpl) CreateCommitEntry

func (conn *DBConnectorImpl) CreateCommitEntry(t models.Timelines) error

func (*DBConnectorImpl) CreateDeployEntry

func (conn *DBConnectorImpl) CreateDeployEntry(deploy models.Timelines) error

func (*DBConnectorImpl) CreateProjectTableEntry

func (conn *DBConnectorImpl) CreateProjectTableEntry(p *models.Projects) error

func (*DBConnectorImpl) CreateServiceTableEntry

func (conn *DBConnectorImpl) CreateServiceTableEntry(s *models.Services) error

func (*DBConnectorImpl) DeleteServiceTableEntry

func (conn *DBConnectorImpl) DeleteServiceTableEntry(name string) (models.Services, error)

func (*DBConnectorImpl) DeleteTimelinesByService

func (conn *DBConnectorImpl) DeleteTimelinesByService(service models.Services) error

func (*DBConnectorImpl) Exec

func (conn *DBConnectorImpl) Exec(sql string) error

func (*DBConnectorImpl) GetCommitByRef

func (conn *DBConnectorImpl) GetCommitByRef(ref string) (models.Timelines, int64, error)

func (*DBConnectorImpl) GetCommitsAll

func (conn *DBConnectorImpl) GetCommitsAll(offset int, limit int, q structs.Query) ([]models.Timelines, int64, error)

func (*DBConnectorImpl) GetCommitsByProject

func (conn *DBConnectorImpl) GetCommitsByProject(project models.Projects, offset int, limit int, q structs.Query) ([]models.Timelines, int64, error)

func (*DBConnectorImpl) GetCommitsByService

func (conn *DBConnectorImpl) GetCommitsByService(service models.Services, offset int, limit int, q structs.Query) ([]models.Timelines, int64, error)

func (*DBConnectorImpl) GetDeployByRef

func (conn *DBConnectorImpl) GetDeployByRef(ref string) (models.Timelines, int64, error)

func (*DBConnectorImpl) GetDeploysAll

func (conn *DBConnectorImpl) GetDeploysAll(offset int, limit int, q structs.Query) ([]models.Timelines, int64, error)

func (*DBConnectorImpl) GetDeploysByProject

func (conn *DBConnectorImpl) GetDeploysByProject(project models.Projects, offset int, limit int, q structs.Query) ([]models.Timelines, int64, error)

func (*DBConnectorImpl) GetDeploysByService

func (conn *DBConnectorImpl) GetDeploysByService(service models.Services, offset int, limit int, q structs.Query) ([]models.Timelines, int64, error)

func (*DBConnectorImpl) GetLatest

func (*DBConnectorImpl) GetProjectByID

func (conn *DBConnectorImpl) GetProjectByID(id int) (models.Projects, int64, error)

func (*DBConnectorImpl) GetProjectByName

func (conn *DBConnectorImpl) GetProjectByName(name string) (models.Projects, int64, error)

func (*DBConnectorImpl) GetProjectByRepo

func (conn *DBConnectorImpl) GetProjectByRepo(repo string) (models.Projects, error)

func (*DBConnectorImpl) GetProjectsAll

func (conn *DBConnectorImpl) GetProjectsAll(offset int, limit int, q structs.Query) ([]models.Projects, int64, error)

func (*DBConnectorImpl) GetProjectsByService

func (conn *DBConnectorImpl) GetProjectsByService(service models.Services, offset int, limit int, q structs.Query) ([]models.Projects, int64, error)

func (*DBConnectorImpl) GetServiceByID

func (conn *DBConnectorImpl) GetServiceByID(id int) (models.Services, int64, error)

func (*DBConnectorImpl) GetServiceByName

func (conn *DBConnectorImpl) GetServiceByName(name string) (models.Services, int64, error)

func (*DBConnectorImpl) GetServiceByRepo

func (conn *DBConnectorImpl) GetServiceByRepo(repo string) (models.Services, error)

func (*DBConnectorImpl) GetServiceNames

func (conn *DBConnectorImpl) GetServiceNames() ([]string, error)

func (*DBConnectorImpl) GetServicesAll

func (conn *DBConnectorImpl) GetServicesAll(offset int, limit int, q structs.Query) ([]structs.ExpandedServicesData, int64, error)

func (*DBConnectorImpl) GetTimelineByRef

func (conn *DBConnectorImpl) GetTimelineByRef(ref string) (models.Timelines, int64, error)

func (*DBConnectorImpl) GetTimelinesAll

func (conn *DBConnectorImpl) GetTimelinesAll(offset int, limit int, q structs.Query) ([]models.Timelines, int64, error)

*

  • GetTimeline returns a timeline of commits and deploys for a service

func (*DBConnectorImpl) GetTimelinesByProject

func (conn *DBConnectorImpl) GetTimelinesByProject(project models.Projects, offset int, limit int, q structs.Query) ([]models.Timelines, int64, error)

func (*DBConnectorImpl) GetTimelinesByService

func (conn *DBConnectorImpl) GetTimelinesByService(service models.Services, offset int, limit int, q structs.Query) ([]models.Timelines, int64, error)

func (*DBConnectorImpl) UpdateProjectTableEntry

func (conn *DBConnectorImpl) UpdateProjectTableEntry(p *models.Projects) error

func (*DBConnectorImpl) UpdateServiceTableEntry

func (conn *DBConnectorImpl) UpdateServiceTableEntry(name string, s config.Service) (service models.Services, err error)

Jump to

Keyboard shortcuts

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