postgres

package
v0.0.0-...-6794c67 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DestructiveReMigrateForTest

func DestructiveReMigrateForTest(cfg *config.Postgres) error

Types

type NewRollout

type NewRollout struct {
	Id                   int32  `db:"id, primarykey, autoincrement"`
	PolicyName           string `db:"policy_name"`
	PolicyNodeGroup      string `db:"policy_node_group"`
	PolicyRevisionId     string `db:"policy_revision_id"`
	PolicyDomainURL      string `db:"policy_domain_url"`
	PolicyDomainUsername string `db:"policy_domain_username"`
	SCMType              string `db:"scm_type"`
	SCMWebType           string `db:"scm_web_type"`
	PolicySCMURL         string `db:"policy_scm_url"`
	PolicySCMWebURL      string `db:"policy_scm_web_url"`
	PolicySCMCommit      string `db:"policy_scm_commit"`
	SCMAuthorName        string `db:"scm_author_name"`
	SCMAuthorEmail       string `db:"scm_author_email"`
	Description          string `db:"description"`
	CiJobId              string `db:"ci_job_id"`
	CiJobUrl             string `db:"ci_job_url"`
}

type NodeSegment

type NodeSegment struct {
	PolicyName      string
	PolicyNodeGroup string
	PolicyDomainURL string
}

type NodeSegmentWithRollouts

type NodeSegmentWithRollouts struct {
	NodeSegment
	Rollouts []*Rollout
}

type PolicyRev

type PolicyRev struct {
	PolicyName string `db:"policy_name"`
	ID         string `db:"id"`
}

type Postgres

type Postgres struct {
	*config.Postgres
	// contains filtered or unexported fields
}

func New

func New(config *config.Postgres) *Postgres

func Open

func Open(config *config.Postgres) (*Postgres, error)

func (*Postgres) AddPolicyCookbooks

func (p *Postgres) AddPolicyCookbooks(ctx context.Context,
	cookbooks []backend.PolicyCookbookLock, policyRevisionID, policyName string) error

func (*Postgres) Clear

func (p *Postgres) Clear() error

func (*Postgres) Close

func (p *Postgres) Close() error

func (*Postgres) Connect

func (p *Postgres) Connect() error

func (*Postgres) CreateRollout

func (p *Postgres) CreateRollout(ctx context.Context, r *NewRollout) (*Rollout, error)

CreateRollout takes the given rollout attributes and attempts to store the rollout in the database.

func (*Postgres) CreateRolloutFromChefAction

func (p *Postgres) CreateRolloutFromChefAction(ctx context.Context, r *NewRollout) error

func (*Postgres) DestructiveReMigrateForTest

func (db *Postgres) DestructiveReMigrateForTest() error

func (*Postgres) FindRolloutByID

func (p *Postgres) FindRolloutByID(ctx context.Context, id int32) (*Rollout, error)

func (*Postgres) FindRolloutByNodeSegmentAndTime

func (p *Postgres) FindRolloutByNodeSegmentAndTime(nodeSegment *NodeSegment, time *time.Time) (*Rollout, error)

func (*Postgres) GetPolicyCookbooks

func (p *Postgres) GetPolicyCookbooks(revisionID string) (backend.PolicyCookbooks, error)

func (*Postgres) GetRollouts

func (p *Postgres) GetRollouts(ctx context.Context) ([]*Rollout, error)

func (*Postgres) ListNodeSegmentsForRolloutProgress

func (p *Postgres) ListNodeSegmentsForRolloutProgress() ([]*NodeSegmentWithRollouts, error)

func (*Postgres) Migrate

func (p *Postgres) Migrate() error

func (*Postgres) Ping

func (p *Postgres) Ping() error

ping will verify if the database mapped with gorp is available

type Rollout

type Rollout struct {
	NewRollout
	StartTime *time.Time `db:"start_time"`
	EndTime   *time.Time `db:"end_time"`
}

type RolloutWithOrderIndex

type RolloutWithOrderIndex struct {
	Rollout
	OrderIndex     int   `db:"order_index"`     // present in query for last N rollouts per segment
	CurrentRollout *bool `db:"current_rollout"` // db uses this to enforce uniqueness of current rollouts
}

Jump to

Keyboard shortcuts

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