postgres

package
v0.0.0-...-eeb60d1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUserWithEmailExist = errors.New("User with the same given email exists")

Functions

This section is empty.

Types

type PGOptions

type PGOptions struct {
	SSLMode             string
	Host                string
	User                string
	DBName              string
	Password            string
	Port                int
	MaxOpenConnections  int
	MaxIdleConnections  int
	ConnMaxLifetime     time.Duration
	Timeout             time.Duration
	ConnMaxIdleTime     time.Duration
	StatusCheckInterval time.Duration
	BaseContext         context.Context
}

type PostgresDatabase

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

func NewPostgresDatabase

func NewPostgresDatabase(options PGOptions, runMigrations bool) (*PostgresDatabase, error)

func (*PostgresDatabase) AddFileTypeIfNotExist

func (p *PostgresDatabase) AddFileTypeIfNotExist(id string) error

func (*PostgresDatabase) CreateUser

func (*PostgresDatabase) GetFile

func (p *PostgresDatabase) GetFile(name []string, tags []string) (models.File, error)

func (*PostgresDatabase) GetFileList

func (p *PostgresDatabase) GetFileList() ([]models.File, error)

func (*PostgresDatabase) GetFileTypes

func (p *PostgresDatabase) GetFileTypes() ([]models.FileType, error)

func (*PostgresDatabase) GetFilesSize

func (p *PostgresDatabase) GetFilesSize() (int, error)

func (*PostgresDatabase) GetUserByEmail

func (p *PostgresDatabase) GetUserByEmail(email string) (*models.UserWithPassword, error)

func (*PostgresDatabase) GetUserList

func (p *PostgresDatabase) GetUserList() ([]models.User, error)

func (PostgresDatabase) Migrate

func (p PostgresDatabase) Migrate() error

func (*PostgresDatabase) NewSerializableTransaction

func (p *PostgresDatabase) NewSerializableTransaction(ctx context.Context) (database.Transaction, error)

func (*PostgresDatabase) NewTransaction

func (p *PostgresDatabase) NewTransaction(ctx context.Context, isolation sql.IsolationLevel) (database.Transaction, error)

func (*PostgresDatabase) SaveFile

func (p *PostgresDatabase) SaveFile(file models.File) error

func (*PostgresDatabase) UpdateUserLastLogin

func (p *PostgresDatabase) UpdateUserLastLogin(userId int) error

type PostgresTransaction

type PostgresTransaction struct {
	PostgresDatabase
	// contains filtered or unexported fields
}

func (*PostgresTransaction) Commit

func (p *PostgresTransaction) Commit() error

func (*PostgresTransaction) Rollback

func (p *PostgresTransaction) Rollback() error

Jump to

Keyboard shortcuts

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