postgres

package
v0.0.0-...-8bff5d1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package postgres implements functions for the manipulation of databases.

Index

Constants

View Source
const (
	// Orders table
	Orders table = "orders"
	// Products table
	Products table = "products"
	// Reviews table
	Reviews table = "reviews"
	// Shops table
	Shops table = "shops"
	// Users table
	Users table = "users"
)

Variables

This section is empty.

Functions

func AddPagination

func AddPagination(query string, params params.Query) (string, []interface{})

AddPagination adds pagination to a query, returns it and the arguments to be used.

func Connect

func Connect(ctx context.Context, c config.Postgres) (*sqlx.DB, error)

Connect creates a connection with the database using the postgres driver and checks the existence of all the tables.

It returns a pointer to the sql.DB struct, the close function and an error.

func Migrate

func Migrate(ctx context.Context, db *sqlx.DB) error

Migrate creates database tables, indexes and triggers.

Types

This section is empty.

Jump to

Keyboard shortcuts

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