postgresql

package
v2.1.0-preview.4.2+inc... Latest Latest
Warning

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

Go to latest
Published: May 7, 2019 License: CC0-1.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PostgresConnectURI

func PostgresConnectURI(conf DBConfig) string

PostgresConnectURI creates a connection string, which is used by the golang sql Open() function

Types

type DBConfig

type DBConfig struct {
	User     string
	Password string
	Address  string
	DBName   string
	SSLMode  string
}

DBConfig contains everything neccecary to setup a postgres db connection

type Service

type Service struct {
	Log api.LogService
	Env api.Settings
	// contains filtered or unexported fields
}

Service to help abstract the technical implementation per driver used.

func NewPostgresService

func NewPostgresService(config DBConfig, logger api.LogService) *Service

NewPostgresService returns a configured postgres service

func (*Service) Array

func (service *Service) Array(model interface{}, expr string, retval interface{}, condition string, params ...interface{})

Array fills an array from the model and expression.

func (*Service) ColumnsWhere

func (service *Service) ColumnsWhere(model interface{}, columns []string, condition string, params ...interface{}) error

ColumnsWhere is a conditional selection based on the model in the data store only returning specific quoted columns.

func (*Service) Count

func (service *Service) Count(model interface{}, condition string, params ...interface{}) int

Count return the number of rows found.

func (*Service) CountExpr

func (service *Service) CountExpr(model interface{}, expr string, retval interface{}, condition string, params ...interface{})

CountExpr return the number of rows found with an expression.

func (*Service) Delete

func (service *Service) Delete(query interface{}) error

Delete removes the model from the data store

func (*Service) Find

func (service *Service) Find(query interface{}, callback func(query interface{}))

Find will check if the model exists and run the additional functionality.

func (*Service) FindAll

func (service *Service) FindAll(query interface{}) error

FindAll instances of a type of model.

func (*Service) Insert

func (service *Service) Insert(query ...interface{}) error

Insert persists the new model in the data store

func (*Service) Raw

func (service *Service) Raw(query interface{}, params ...interface{}) error

Raw executes a string of SQL.

func (*Service) Save

func (service *Service) Save(query ...interface{}) error

Save persists the model in the data store

func (*Service) Select

func (service *Service) Select(query interface{}) error

Select returns the model from the data store

func (*Service) Update

func (service *Service) Update(query interface{}) error

Update persists the existing model in the data store

func (*Service) Where

func (service *Service) Where(model interface{}, condition string, params ...interface{}) error

Where is a conditional selection based on the model in the data store.

Jump to

Keyboard shortcuts

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