springbootlike

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHealthRoutes

func AddHealthRoutes()

func NewDatabase

func NewDatabase(ctx context.Context, cfg AppConfig) (database.Database, error)

Types

type API

type API interface {
	InitAPI()
}

func NewAPI

func NewAPI(service Service) API

type AppConfig

type AppConfig struct {
	config.BaseConfig `yaml:",inline"`
}

func LoadConfig

func LoadConfig() (AppConfig, error)

func (AppConfig) GetBaseConfig

func (c AppConfig) GetBaseConfig() config.BaseConfig

type Book

type Book struct {
	ID          uuid.UUID `db:"id"`
	Title       string    `db:"title"`
	Description string    `db:"description"`
}

type BookDTO

type BookDTO struct {
	ID          uuid.UUID `json:"id"`
	Title       string    `json:"title"`
	Description string    `json:"description"`
}

type NewBookDTO

type NewBookDTO struct {
	Title       string `json:"title"`
	Description string `json:"description"`
}

type Repository

type Repository interface {
	SaveBook(ctx context.Context, tx database.DBTX, book Book) (Book, error)
	FindBooks(ctx context.Context, tx database.DBTX, pageRequest database.PageRequest) (database.Page[Book], error)
	FindOptionalBookByID(ctx context.Context, tx database.DBTX, id uuid.UUID) (*Book, error)
	DeleteBookByID(ctx context.Context, tx database.DBTX, id uuid.UUID) error
}

func NewRepository

func NewRepository() Repository

type Service

type Service interface {
	CreateBook(ctx context.Context, newBook NewBookDTO, tx ...database.DBTX) (BookDTO, error)
	GetBooks(ctx context.Context, pageRequest database.PageRequest, tx ...database.DBTX) (database.Page[BookDTO], error)
	GetBookByID(ctx context.Context, id uuid.UUID, tx ...database.DBTX) (BookDTO, error)
	DeleteBookByID(ctx context.Context, id uuid.UUID, tx ...database.DBTX) error
}

func NewService

func NewService(mq queue.Queue, db database.Database, repository Repository) Service

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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