pg

package
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, db *sql.DB, cfg *Config) (plugins.IPlugin, error)

Types

type Config

type Config struct {
	// Table options
	Table      string // schema name + table.name
	FileCol    string //  character varying field for file name
	KeyCol     string //  character varying field for key
	ValCol     string //  BYTEA (binary) field for value
	VersionCol string //  character varying field for version

	//
	Version string // value for version for current request series. Keep it empty if you don't use versions.

	// cache options
	UseCache   bool // use or not use cache
	UsePreload bool // loads all data for the version from DB and saves them to cache. Useful for tests

	// Human-readable file name, it's false by default and plugin uses MD5 of file name.
	// The length of the file name depends on the length of the URL and can be very long.
	// Use HumanReadableFileName=true to prevent FileCol size error.
	HumanReadableFileName bool
}

type PG

type PG struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*PG) PreloadByVersion

func (p *PG) PreloadByVersion() error

PreloadByVersion loads all data for the version from DB and saves them to cache.

func (*PG) Read

func (p *PG) Read(fileName, key string) (out []byte, err error)

func (*PG) Save

func (p *PG) Save(fileName, key string, data []byte) error

func (*PG) SetVersion

func (p *PG) SetVersion(version string) error

func (*PG) VerboseMode added in v0.1.16

func (s *PG) VerboseMode(mode bool)

VerboseMode sets up "verbose" mode

Jump to

Keyboard shortcuts

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