repository

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NoteRepo

type NoteRepo interface {
	Create(ctx *gin.Context, note *models.Note) error
	Read(ctx *gin.Context, note *models.Note) error
	ReadByUserName(ctx *gin.Context, user string) ([]models.Note, error)
	ReadAll(ctx *gin.Context) ([]models.Note, error)
	Update(ctx *gin.Context, note models.Note) (models.Note, error)
	Delete(ctx *gin.Context, note *models.Note) error
	DeleteAllByUserName(ctx *gin.Context, username string) error
	VerifyPassword(ctx *gin.Context, username, password string) (bool, error)
}

func NewNoteRepo

func NewNoteRepo(db *gorm.DB) NoteRepo

NewNoteRepo initializes the note repository

type UserRepo added in v0.1.0

type UserRepo interface {
	// CreateUser creates a new user
	CreateUser(user *models.User) error
	// GetUserByID returns a user by id
	GetUser(id int) (models.User, error)
	// GetUsers returns all users
	GetUsers() ([]models.User, error)
	// GetUserByUsername returns a user by username
	GetUserByUsername(username string) (models.User, error)
	// GetUserByEmail returns a user by email
	GetUserByEmail(email string) (models.User, error)
	// UpdateUser updates an existing user
	UpdateUser(user *models.User) error
	// DeleteUser deletes an existing user
	DeleteUser(id uint) error
}

UserRepo is a repository for users

func NewUserRepo added in v0.1.0

func NewUserRepo(db *gorm.DB) UserRepo

NewUserRepo initializes a new user repository

Jump to

Keyboard shortcuts

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