api

package
v0.0.0-...-0db7fb7 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2025 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

pkg/api/handler.go

pkg/api/ptrconv.go

pkg/api/problem_details_renderer.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewStrictServerImpl

func NewStrictServerImpl(opsHandler *operations.Handler, dbPool *pgxpool.Pool, redisPool *redis.Pool, sm *scs.SessionManager) openapi.StrictServerInterface

func Ptr

func Ptr[T any](v T) *T

Ptr は v のポインタを返す どんな型でも利用可能

func PtrOrNil

func PtrOrNil[T comparable](v T) *T

PtrOrNil は v が T のゼロ値(== zero)なら nil を返し、 そうでなければ v のポインタを返す 比較可能な型(comparable)でのみ利用可能

func RateLimiter

func RateLimiter(rps rate.Limit, burst int) gin.HandlerFunc

RateLimiter returns a Gin middleware that allows r tokens per second with burst b.

func UpdateOrKeep

func UpdateOrKeep[T comparable](current T, newVal *T) T

UpdateOrKeep は、newVal が nil でなくかつゼロ値でないなら *newVal を返し、 それ以外は current を返す T は comparable 制約なので、ゼロ値チェックのために == zero が利用可能

Types

type ProblemDetailsRenderer

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

func NewProblemDetailsRenderer

func NewProblemDetailsRenderer(uriReferenceBase string, logger *slog.Logger, tracer oteltrace.Tracer) (*ProblemDetailsRenderer, error)

func (*ProblemDetailsRenderer) Middleware

func (p *ProblemDetailsRenderer) Middleware() gin.HandlerFunc

type RequestSizeLimiter

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

func NewRequestSizeLimiter

func NewRequestSizeLimiter(uriReferenceBase string, logger *slog.Logger) (*RequestSizeLimiter, error)

func (*RequestSizeLimiter) Middleware

func (p *RequestSizeLimiter) Middleware(maxBytes int64) gin.HandlerFunc

type StrictServerImpl

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

StrictServerInterface の実装用

func (*StrictServerImpl) CreateUser

Create a new user (POST /users)

func (*StrictServerImpl) DeleteUserById

Delete a user by ID (DELETE /users/{user_id})

func (*StrictServerImpl) GetHealthLiveness

Liveness チェック (GET /health/liveness)

func (*StrictServerImpl) GetHealthReadiness

Readiness チェック (GET /health/readiness)

func (*StrictServerImpl) GetUserById

Get a user by ID (GET /users/{user_id})

func (*StrictServerImpl) ListUsers

List all users (GET /users)

func (*StrictServerImpl) UpdateUserById

Update a user by ID (PATCH /users/{user_id})

Directories

Path Synopsis
pkg/api/openapi/generate.go
pkg/api/openapi/generate.go

Jump to

Keyboard shortcuts

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