store

package
v0.0.0-...-1afdef6 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicateEmail = errors.New("duplicate email")
)

Functions

This section is empty.

Types

type Storage

type Storage struct {
	Students StudentRepository
}

func NewStudentStore

func NewStudentStore(db *sql.DB) *Storage

type Student

type Student struct {
	ID        int64     `json:"id"`
	FirstName string    `json:"first_name" binding:"required"`
	LastName  string    `json:"last_name" binding:"required"`
	Email     string    `json:"email" binding:"required,email"`
	Age       int       `json:"age" binding:"required"`
	Sex       string    `json:"sex" binding:"required"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type StudentRepository

type StudentRepository interface {
	Create(ctx context.Context, student *Student) error
}

type StudentStore

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

func (*StudentStore) Create

func (s *StudentStore) Create(ctx context.Context, student *Student) error

Jump to

Keyboard shortcuts

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