bunapp

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: AGPL-3.0 Imports: 39 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithApp

func ContextWithApp(ctx context.Context, app *App) context.Context

func FS

func FS() fs.FS

func NewCookie

func NewCookie(app *App, req bunrouter.Request) *http.Cookie

func UnmarshalValues

func UnmarshalValues(req bunrouter.Request, filter any) error

func WaitExitSignal

func WaitExitSignal() os.Signal

Types

type App

type App struct {
	Logger *otelzap.Logger

	PG *bun.DB
	CH *ch.DB

	QueueFactory taskq.Factory
	MainQueue    taskq.Queue

	HTTPClient *http.Client
	// contains filtered or unexported fields
}

func AppFromContext

func AppFromContext(ctx context.Context) *App

func New

func New(ctx context.Context, conf *bunconf.Config) (*App, error)

func (*App) Config

func (app *App) Config() *bunconf.Config

func (*App) Context

func (app *App) Context() context.Context

func (*App) Debug

func (app *App) Debug() bool

func (*App) Done

func (app *App) Done() <-chan struct{}

func (*App) GRPCServer

func (app *App) GRPCServer() *grpc.Server

func (*App) HTTPHandler

func (app *App) HTTPHandler() http.Handler

func (*App) InternalAPIV1 added in v1.7.0

func (app *App) InternalAPIV1() *bunrouter.Group

func (*App) OnStop

func (app *App) OnStop(name string, fn HookFunc)

func (*App) OnStopped

func (app *App) OnStopped(name string, fn HookFunc)

func (*App) PublicAPIV1 added in v1.7.0

func (app *App) PublicAPIV1() *bunrouter.Group

func (*App) RegisterQueue

func (app *App) RegisterQueue(conf *taskq.QueueConfig) taskq.Queue

func (*App) RegisterTask

func (app *App) RegisterTask(name string, conf *taskq.TaskConfig) *taskq.Task

func (*App) Router

func (app *App) Router() *bunrouter.Router

func (*App) RouterGroup

func (app *App) RouterGroup() *bunrouter.Group

func (*App) SiteURL

func (app *App) SiteURL(path string, args ...any) string

func (*App) Stop

func (app *App) Stop()

func (*App) WaitGroup

func (app *App) WaitGroup() *sync.WaitGroup

func (*App) WithGlobalLock

func (app *App) WithGlobalLock(ctx context.Context, fn func() error) error

func (*App) Zap

func (app *App) Zap(ctx context.Context) otelzap.LoggerWithCtx

type HookFunc

type HookFunc func(ctx context.Context, app *App) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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