bdkeeper

package
v0.0.0-...-0776f63 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BDKeeper

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

BDKeeper represents a database keeper.

func NewBDKeeper

func NewBDKeeper(dsn func() string, log Log, db *sql.DB) (*BDKeeper, error)

NewBDKeeper creates a new BDKeeper instance.

func (*BDKeeper) AddData

func (bdk *BDKeeper) AddData(ctx context.Context, table string, user_id int, entry_id string, data map[string]string) error

AddData adds data to a table in the database.

func (*BDKeeper) AddUser

func (bdk *BDKeeper) AddUser(ctx context.Context, username string, hashedPassword string) error

AddUser adds a new user to the database.

func (*BDKeeper) Close

func (bdk *BDKeeper) Close() bool

Close closes the connection to the PostgreSQL database and returns true if successful, otherwise false.

func (*BDKeeper) DeleteData

func (bdk *BDKeeper) DeleteData(ctx context.Context, table string, user_id int, entry_id string) error

DeleteData marks data as deleted in a table in the database and updates the 'updated_at' field.

func (*BDKeeper) GetAllData

func (bdk *BDKeeper) GetAllData(ctx context.Context, table string, userID int, lastSync time.Time, inclDel bool) ([]map[string]string, error)

GetAllData retrieves all data from a table in the database.

func (*BDKeeper) GetPassword

func (bdk *BDKeeper) GetPassword(ctx context.Context, username string) (string, error)

GetPassword retrieves the hashed password of a user from the database.

func (*BDKeeper) GetUserID

func (bdk *BDKeeper) GetUserID(ctx context.Context, username string) (int, error)

GetUserID retrieves the user ID of a user from the database.

func (*BDKeeper) Ping

func (bdk *BDKeeper) Ping() bool

Ping checks the connectivity to the PostgreSQL database and returns true if successful, otherwise false.

func (*BDKeeper) UpdateData

func (bdk *BDKeeper) UpdateData(ctx context.Context, table string, user_id int, entry_id string, data map[string]string) error

UpdateData updates data in a table in the database.

func (*BDKeeper) UserExists

func (bdk *BDKeeper) UserExists(ctx context.Context, username string) (bool, error)

UserExists checks if a user exists in the database.

type Log

type Log interface {
	Info(string, ...zapcore.Field)
}

Log represents a logging interface.

Jump to

Keyboard shortcuts

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