ent: github.com/facebookincubator/ent/dialect Index | Files | Directories

package dialect

import "github.com/facebookincubator/ent/dialect"

Index

Package Files

dialect.go

Constants

const (
    MySQL    = "mysql"
    SQLite   = "sqlite3"
    Postgres = "postgres"
    Gremlin  = "gremlin"
)

Dialect names for external usage.

type DebugDriver Uses

type DebugDriver struct {
    Driver // underlying driver.
    // contains filtered or unexported fields
}

DebugDriver is a driver that logs all driver operations.

func (*DebugDriver) Exec Uses

func (d *DebugDriver) Exec(ctx context.Context, query string, args, v interface{}) error

Exec logs its params and calls the underlying driver Exec method.

func (*DebugDriver) Query Uses

func (d *DebugDriver) Query(ctx context.Context, query string, args, v interface{}) error

Query logs its params and calls the underlying driver Query method.

func (*DebugDriver) Tx Uses

func (d *DebugDriver) Tx(ctx context.Context) (Tx, error)

Tx adds an log-id for the transaction and calls the underlying driver Tx command.

type DebugTx Uses

type DebugTx struct {
    Tx  // underlying transaction.
    // contains filtered or unexported fields
}

DebugTx is a transaction implementation that logs all transaction operations.

func (*DebugTx) Commit Uses

func (d *DebugTx) Commit() error

Commit logs this step and calls the underlying transaction Commit method.

func (*DebugTx) Exec Uses

func (d *DebugTx) Exec(ctx context.Context, query string, args, v interface{}) error

Exec logs its params and calls the underlying transaction Exec method.

func (*DebugTx) Query Uses

func (d *DebugTx) Query(ctx context.Context, query string, args, v interface{}) error

Query logs its params and calls the underlying transaction Query method.

func (*DebugTx) Rollback Uses

func (d *DebugTx) Rollback() error

Rollback logs this step and calls the underlying transaction Rollback method.

type Driver Uses

type Driver interface {
    ExecQuerier
    // Tx starts and returns a new transaction.
    // The provided context is used until the transaction is committed or rolled back.
    Tx(context.Context) (Tx, error)
    // Close closes the underlying connection.
    Close() error
    // Dialect returns the dialect name of the driver.
    Dialect() string
}

Driver is the interface that wraps all necessary operations for ent clients.

func Debug Uses

func Debug(d Driver, logger ...func(...interface{})) Driver

Debug gets a driver and an optional logging function, and returns a new debugged-driver that prints all outgoing operations.

type ExecQuerier Uses

type ExecQuerier interface {
    // Exec executes a query that doesn't return rows. For example, in SQL, INSERT or UPDATE.
    // It scans the result into the pointer v. In SQL, you it's usually sql.Result.
    Exec(ctx context.Context, query string, args, v interface{}) error
    // Query executes a query that returns rows, typically a SELECT in SQL.
    // It scans the result into the pointer v. In SQL, you it's usually *sql.Rows.
    Query(ctx context.Context, query string, args, v interface{}) error
}

ExecQuerier wraps the 2 database operations.

type Tx Uses

type Tx interface {
    ExecQuerier
    driver.Tx
}

Tx wraps the Exec and Query operations in transaction.

func NopTx Uses

func NopTx(d Driver) Tx

NopTx returns a Tx with a no-op Commit / Rollback methods wrapping the provided Driver d.

Directories

PathSynopsis
gremlin
gremlin/encoding
gremlin/encoding/graphson
gremlin/graph
gremlin/graph/dslPackage dsl provide an API for writing gremlin dsl queries almost as-is in Go without using strings in the code.
gremlin/graph/dsl/__
gremlin/graph/dsl/g
gremlin/graph/dsl/p
gremlin/ocgremlin
sql
sql/schemaPackage schema contains all schema migration logic for SQL dialects.

Package dialect imports 5 packages (graph) and is imported by 9 packages. Updated 2019-11-19. Refresh now. Tools for package owners.