oro

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Context

func Context(ctx interface {
	DB(...string) database.Database
}, name ...string) *orodb.DB

Context returns the Oro runtime from a route-like context.

func Driver

func Driver(items ...Option) database.Driver

Database creates an Oro database driver.

func From

func From(db database.Database) *orodb.DB

From returns the raw Oro runtime from a Runa database.

Types

type ConfigReader

type ConfigReader interface {
	GetString(string, string) string
	GetInt(string, int) int
}

ConfigReader reads config values used by the Oro driver.

type Option

type Option func(*options)

Option configures an Oro database driver.

func Config

func Config(path string) Option

Config reads database config from app config path.

func DB added in v0.1.2

func DB(value *orodb.DB) Option

DB uses an existing Oro DB. The runtime will not close injected DBs.

func DSN

func DSN(value string) Option

DSN sets the database DSN.

func Debug

func Debug(enabled bool) Option

Debug enables debug SQL logs.

func Dialect

func Dialect(name string) Option

Dialect sets the SQL dialect.

func Location

func Location(value *time.Location) Option

Location sets the timezone used by Oro for time values.

func Logger

func Logger(name string) Option

Logger sets the Runa logger channel.

func MaxIdle

func MaxIdle(value int) Option

MaxIdle sets max idle connections.

func MaxLifetime

func MaxLifetime(value time.Duration) Option

MaxLifetime sets max connection lifetime.

func MaxOpen

func MaxOpen(value int) Option

MaxOpen sets max open connections.

func Meta

func Meta(key string, value any) Option

Meta sets runtime metadata.

type OroDatabase

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

OroDatabase is a Runa database runtime for Oro.

func (*OroDatabase) Close

func (db *OroDatabase) Close(ctx context.Context) error

Close closes the database.

func (*OroDatabase) Info

func (db *OroDatabase) Info() database.Info

Info returns runtime info.

func (*OroDatabase) Kind

func (db *OroDatabase) Kind() string

Kind returns runtime kind.

func (*OroDatabase) Name

func (db *OroDatabase) Name() string

Name returns runtime name.

func (*OroDatabase) Oro

func (db *OroDatabase) Oro() *orodb.DB

Oro returns the raw Oro DB.

func (*OroDatabase) Ping

func (db *OroDatabase) Ping(ctx context.Context) error

Ping checks database availability.

func (*OroDatabase) Raw

func (db *OroDatabase) Raw() any

Raw returns the raw Oro DB.

Jump to

Keyboard shortcuts

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