Back to godoc.org

Package postgres

v1.0.1
Latest Go to latest
Published: Jul 31, 2020 | License: AGPL-3.0 | Module: github.com/RTradeLtd/go-datastores

Index

Package Files

Variables

var (
	// RecreateTables indicates that you accept all consequences from dropping your table and recreating it
	RecreateTables = "recreate tables"
)

type Options

type Options struct {
	// AcceptRecreateWarning is used as a safety check to pevent accidental deletion of existing tables and data
	// To accept the warning, you must set the value of this field to `recreate tables`, which can be done manually
	// or via the usage of the public `RecreateTables` variable
	AcceptRecreateWarning string
	Host                  string
	Port                  string
	User                  string
	Password              string
	Database              string
	Table                 string
	SSLMode               string
	RunMigrations         bool
	RecreateTables        bool
	CreateIndex           bool
}

Options are the postgres datastore options, reexported here for convenience.

func (*Options) Create

func (opts *Options) Create() (*sqlds.Datastore, error)

Create returns a datastore connected to postgres

type Queries

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

Queries are the postgres queries for a given table.

func NewQueries

func NewQueries(tbl string) Queries

NewQueries creates a new PostgreSQL set of queries for the passed table

func (Queries) Delete

func (q Queries) Delete() string

Delete returns the postgres query for deleting a row.

func (Queries) Exists

func (q Queries) Exists() string

Exists returns the postgres query for determining if a row exists.

func (Queries) Get

func (q Queries) Get() string

Get returns the postgres query for getting a row.

func (Queries) GetSize

func (q Queries) GetSize() string

GetSize returns the postgres query for determining the size of a value.

func (Queries) Limit

func (q Queries) Limit() string

Limit returns the postgres query fragment for limiting results.

func (Queries) Offset

func (q Queries) Offset() string

Offset returns the postgres query fragment for returning rows from a given offset.

func (Queries) Prefix

func (q Queries) Prefix() string

Prefix returns the postgres query fragment for getting a rows with a key prefix.

func (Queries) Put

func (q Queries) Put() string

Put returns the postgres query for putting a row.

func (Queries) Query

func (q Queries) Query() string

Query returns the postgres query for getting multiple rows.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier