pggit

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CreateTableSql = `
CREATE TABLE IF NOT EXISTS %s
(
    id serial,
    ` + fileNameCol + ` character varying(40) COLLATE pg_catalog."default" NOT NULL,
    ` + keyCol + ` character varying(40) COLLATE pg_catalog."default" NOT NULL,
    ` + versionCol + ` character varying(500) COLLATE pg_catalog."default" NOT NULL,
    ` + dataCol + ` bytea,
    date_create timestamp without time zone NOT NULL DEFAULT now(),
    CONSTRAINT %s_pkey PRIMARY KEY (id),
    CONSTRAINT %s_uxk UNIQUE (file_name, key, version)
        WITH (FILLFACTOR=100)
)
`

	DeleteBranchKeySql = `DELETE FROM %s WHERE ` + versionCol + ` = $1 AND ` + keyCol + ` = $2`
	DeleteBranchSql    = `DELETE FROM %s WHERE ` + versionCol + ` = $1`
	UpdateBranchSql    = `UPDATE %s SET ` + versionCol + ` = $1 WHERE ` + versionCol + ` = $2`
	CopyBranchSql      = `
	INSERT INTO %s (` + fileNameCol + `, ` + keyCol + `, ` + dataCol + `, ` + versionCol + `)
	(SELECT ` + fileNameCol + `, ` + keyCol + `, ` + dataCol + `, $1 As ` + versionCol + ` FROM %s WHERE ` + versionCol + ` = $2)
`
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PgGit

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

func New

func New(db *sql.DB, branch, table string, useCache bool) (*PgGit, error)

func (*PgGit) Config

func (pgt *PgGit) Config() *pgPlug.Config

func (*PgGit) DeleteBranch added in v0.0.2

func (pgt *PgGit) DeleteBranch(ctx context.Context, branch string) error

DeleteBranch just cleans brunch's files

func (*PgGit) DeleteBranchKey added in v0.0.4

func (pgt *PgGit) DeleteBranchKey(ctx context.Context, branch, key string) error

DeleteBranchKey just removes one key from brunch's files

func (*PgGit) MergeToBranch added in v0.0.2

func (pgt *PgGit) MergeToBranch(ctx context.Context, branch string) error

MergeToBranch moves all current branch files to incoming branch.

func (*PgGit) Plugin

func (pgt *PgGit) Plugin() plugins.IPlugin

func (*PgGit) PreloadByVersion added in v0.0.7

func (pgt *PgGit) PreloadByVersion() error

PreloadByVersion loads data by 1 request

func (*PgGit) Read

func (pgt *PgGit) Read(file, key string) ([]byte, error)

func (*PgGit) ReplaceFromBranch added in v0.0.2

func (pgt *PgGit) ReplaceFromBranch(ctx context.Context, branch string) error

ReplaceFromBranch replaces all current branch files from incoming branch.

func (*PgGit) Save

func (pgt *PgGit) Save(file, key string, data []byte) error

func (*PgGit) SetVersion

func (pgt *PgGit) SetVersion(branch string) error

Jump to

Keyboard shortcuts

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