students

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(r StudentsRepo, logger *slog.Logger) http.Handler

Types

type ID

type ID string

type Repo

type Repo struct {
	Pool *pgxpool.Pool
}

func (*Repo) Add

func (d *Repo) Add(ctx context.Context, student Student) error

func (*Repo) Delete

func (d *Repo) Delete(ctx context.Context, id ID) error

func (*Repo) GetByAccount

func (d *Repo) GetByAccount(ctx context.Context, account string) (Student, error)

func (*Repo) GetByName

func (d *Repo) GetByName(ctx context.Context, name string) (Student, error)

func (*Repo) List

func (d *Repo) List(ctx context.Context) ([]Student, error)

type Student

type Student struct {
	ID    ID     `json:"id"`
	Name  string `json:"name"`
	Email string `json:"email"`
}

type StudentsRepo

type StudentsRepo interface {
	List(context.Context) ([]Student, error)
	Delete(context.Context, ID) error
	Add(ctx context.Context, student Student) error
}

Jump to

Keyboard shortcuts

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