sen

package module
v0.0.0-...-f5ca623 Latest Latest
Warning

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

Go to latest
Published: May 16, 2025 License: MPL-2.0 Imports: 7 Imported by: 0

README

sen

A SQL library

Go Documentation

func example(c *sen.Client) error {
    var name string
    err := c.Transaction(func(tx *sen.Transaction) error {
        return tx.Query(&name, `
            select name
            from my_table
            where id = {{p .id}}
        `, map[string]any{
            "id": 1,
        })
    })
    if err != nil {
        return err
    }

    fmt.Println(name)
    return nil
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(db *sql.DB, scanTag string) *Client

func (*Client) Close

func (c *Client) Close() error

func (*Client) Transaction

func (c *Client) Transaction(fn func(*Transaction) error) error

func (*Client) WithLog

func (c *Client) WithLog(l Log) *Client

type Log

type Log interface {
	Log(kv ...any) error
}

type Row

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

func (*Row) Close

func (r *Row) Close() error

func (*Row) Err

func (r *Row) Err() error

func (*Row) Next

func (r *Row) Next() bool

func (*Row) Scan

func (r *Row) Scan(dst any) error

type Transaction

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

func (*Transaction) Exec

func (t *Transaction) Exec(stmt string, args any) (int64, error)

func (*Transaction) Query

func (t *Transaction) Query(dst any, stmt string, args any) error

func (*Transaction) QueryRow

func (t *Transaction) QueryRow(stmt string, args any) *Row

Jump to

Keyboard shortcuts

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