internal

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountRoutes

func CountRoutes(r chi.Routes) (int, int)

CountRoutes returns the total number of routes, and the total number of known middlewares.

func PrintRoutes

func PrintRoutes(r chi.Routes)

PrintRoutes will print the number of routes and middlewares, and the routing table.

Types

type DatabaseOption

type DatabaseOption struct {
	MaxOpenConns int
	MaxIdleConns int
}

DatabaseOption configures database connection pooling settings.

func (*DatabaseOption) Apply

func (o *DatabaseOption) Apply(client *sqlx.DB)

Apply applies the database option settings to a database connection.

type DatabaseProvider

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

DatabaseProvider holds a list of named sql connection credentials.

func NewDatabaseProvider

func NewDatabaseProvider(open func(string, string) (*sqlx.DB, error)) *DatabaseProvider

NewDatabaseProvider will allocate a valid `*DatabaseProvider` and return it.

func (*DatabaseProvider) Connect

func (r *DatabaseProvider) Connect(ctx context.Context, names ...string) (*sqlx.DB, error)

Connect issues a PingContext to verify a live connection before returning. The context is used to propagate tracing detail so ping is grouped correctly.

func (*DatabaseProvider) Open

func (r *DatabaseProvider) Open(_ context.Context, names ...string) (*sqlx.DB, error)

Open is the same as sql.Open. It creates a client from a named connection.

func (*DatabaseProvider) Register

func (r *DatabaseProvider) Register(name string, config string)

Register will add a new named credential into the provider. The function is not concurrency safe, database credentials can't be changed during the lifetime of the provider.

Jump to

Keyboard shortcuts

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