postgres

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2022 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package postgres holds PostgreSQL database and repository methods.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

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

Database - PostgreSQL database struct

func New

func New(address string) (*Database, error)

New creates a new PostgreSQL database struct

func (*Database) CreateUser added in v0.3.0

func (db *Database) CreateUser(ctx context.Context, user model.User) (string, error)

CreateUser - Creates a user and returns its ID or an error, if anything fails

func (*Database) DeleteUser added in v0.3.0

func (db *Database) DeleteUser(ctx context.Context, id string) error

DeleteUser - Deletes a User for a given ID and could return an error if anything fails

func (*Database) FindAllUsers added in v0.8.0

func (db *Database) FindAllUsers(ctx context.Context, offset int64, limit int64) ([]model.User, error)

FindAllUsers - Returns all users for a given limit and offset

func (*Database) FindUser added in v0.3.0

func (db *Database) FindUser(ctx context.Context, id string) (model.User, error)

FindUser - Returns a user for a given ID or an error if anything fails

func (*Database) Migrate added in v0.3.2

func (db *Database) Migrate(databaseName string, migrationsPath string) error

Migrate - Runs a database migration for a given database and migrations path with the SQL files It returns an error in case of failure

func (*Database) UpdateUser added in v0.3.0

func (db *Database) UpdateUser(ctx context.Context, user model.User) error

UpdateUser - Updates a user and returns an error if anything fails

Jump to

Keyboard shortcuts

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