repo

package
v0.0.0-...-6f8b084 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2021 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBRepo

type DBRepo struct {
	DB *sql.DB
}

DBRepo use for holding *sql.DB

var Repo *DBRepo

func NewDB

func NewDB(dsn string) (*DBRepo, error)

NewDB create new sqlite3 db for use by its name

func (*DBRepo) CreateStatement

func (dbr *DBRepo) CreateStatement(stat string, ctx context.Context) (*sql.Stmt, error)

CreateStatement use for creating *sql.Stmt for a specific query or statement

func (*DBRepo) CreateUserDataModelMethod

func (dbr *DBRepo) CreateUserDataModelMethod() error

CreateUserDataModelMethod use for creating DataModel for every user

func (*DBRepo) DisposeFunction

func (dbr *DBRepo) DisposeFunction() error

DisposeFunction use for dispose sql.DB

func (*DBRepo) GetUserByItsEmailHMACMethod

func (dbr *DBRepo) GetUserByItsEmailHMACMethod(um string) (string, error)

GetUserByItsEmailHMACMethod use for getting user information by its email

func (*DBRepo) PingingDB

func (dbr *DBRepo) PingingDB() error

PingingDB use for ping db

func (*DBRepo) SaveUserWithHAMCMethod

func (dbr *DBRepo) SaveUserWithHAMCMethod(user *DataModel) error

SaveUserWithHAMCMethod use for save user with its associated key into Database

type DBRepoHMAC

type DBRepoHMAC interface {
	CreateUserDataModelMethod() error
	SaveUserWithHAMCMethod(user *DataModel) error
	GetUserByItsEmailHMACMethod(um string) (string, error)
}

DBRepoHMAC holding our db functionalities schema we need to implement

type DataModel

type DataModel struct {
	ID        int    `json:"id"`
	Mail      string `json:"mail"`
	Key       string `json:"key,omitempty"`
	HmacToken string `json:"hmac_token,omitempty"`
}

DataModel for storing user stuff

type UserClaims

type UserClaims struct {
	*jwt.StandardClaims
	Email string
}

Jump to

Keyboard shortcuts

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