dao

package
v0.0.0-...-7de9431 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserEmailExists = errors.New("user already exists")
	ErrUserNotFound    = errors.New("user not found")
)

Functions

func InitTables

func InitTables(db *gorm.DB) error

Types

type User

type User struct {
	ID uint `gorm:"primaryKey"`

	Email    string `gorm:"unique;not null"`
	Password string `gorm:"not null"`

	CreatedAt time.Time `gorm:"not null"`
	UpdatedAt time.Time `gorm:"not null"`
}

type UserDAO

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

func NewUserDAO

func NewUserDAO(db *gorm.DB) *UserDAO

func (*UserDAO) FindByEmail

func (d *UserDAO) FindByEmail(ctx context.Context, email string) (User, error)

func (*UserDAO) FindByID

func (d *UserDAO) FindByID(ctx context.Context, id uint) (User, error)

func (*UserDAO) Insert

func (d *UserDAO) Insert(ctx context.Context, user User) (User, error)

Jump to

Keyboard shortcuts

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