orm

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB provides main ORM interface.

func Open

func Open(dsn string) (*DB, error)

Open opens a MySQL database with default pooling.

func (*DB) Close

func (db *DB) Close() error

Close closes underlying DB.

func (*DB) Model

func (db *DB) Model(v any) *query.Query

Model creates a query for the struct table.

func (*DB) Table

func (db *DB) Table(name string) *query.Query

Table creates a query for table name.

func (*DB) Transaction

func (db *DB) Transaction(fn func(tx Tx) error) error

Transaction executes fn in a transaction.

type Tx

type Tx struct{ *DB }

Tx represents a transaction-scoped DB wrapper.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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