database

package
v0.0.0-...-a4f5b3f Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckValidEmail

func CheckValidEmail(email string) bool

func InitDb

func InitDb()

func LoadEnv

func LoadEnv() error

Types

type DbInstance

type DbInstance struct {
	Db *sqlx.DB
	Lg *files.Logger
	// contains filtered or unexported fields
}

func GetInstanceDb

func GetInstanceDb() DbInstance

works like a singleton.

func (*DbInstance) AddUserToPending

func (db *DbInstance) AddUserToPending(usr User, photo string) error

func (*DbInstance) ClosePostgres

func (db *DbInstance) ClosePostgres() error

function to close the db connection.

func (*DbInstance) DoesUserExists

func (db *DbInstance) DoesUserExists(usr User, where string) (bool, error)

func (*DbInstance) GetUserData

func (db *DbInstance) GetUserData(username string) (*IUser, error)

func (*DbInstance) LoginUser

func (db *DbInstance) LoginUser(usr User) (bool, error)

type IUser

type IUser struct {
	Id       uint64
	Username string
	Password []byte
	Email    string
	Salt     string
	B64Image string // base64 id image
}

user for internal use (including all attributes that doesn't get passed in the json)

type User

type User struct {
	Username string `json:"username"`
	Password string `json:"password"`
	Email    string `json:"email"`
}

Jump to

Keyboard shortcuts

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