Documentation ¶
Index ¶
- func Bench(db *chai.DB, query string, opt BenchOptions) error
- func CanReadFromStandardInput() bool
- func Dump(db *chai.DB, w io.Writer, tables ...string) error
- func DumpPebble(c context.Context, db *pebble.DB, opt DumpPebbleOptions) error
- func DumpSchema(db *chai.DB, w io.Writer, tables ...string) error
- func ExecSQL(ctx context.Context, db *chai.DB, r io.Reader, w io.Writer) error
- func InsertJSON(db *chai.DB, table string, r io.Reader) error
- func ListIndexes(db *chai.DB, tableName string) ([]string, error)
- func OpenDB(ctx context.Context, dbPath string) (*chai.DB, error)
- func QueryTables(tx *chai.Tx, tables []string, fn func(name, query string) error) error
- func Restore(ctx context.Context, db *chai.DB, dumpFile, dbPath string) error
- type BenchOptions
- type DumpPebbleOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bench ¶
func Bench(db *chai.DB, query string, opt BenchOptions) error
Bench takes a database and dumps its content as SQL queries in the given writer. If tables is provided, only selected tables will be outputted.
func CanReadFromStandardInput ¶
func CanReadFromStandardInput() bool
CanReadFromStandardInput returns whether there is data to be read in stdin.
func Dump ¶
Dump takes a database and dumps its content as SQL queries in the given writer. If tables is provided, only selected tables will be outputted.
func DumpPebble ¶
func DumpSchema ¶
DumpSchema takes a database and dumps its schema as SQL queries in the given writer. If tables are provided, only selected tables will be outputted.
func ExecSQL ¶
ExecSQL reads SQL queries from reader and executes them until the reader is exhausted. If the query has results, they will be outputted to w.
func InsertJSON ¶
InsertJSON reads json objects from r and inserts them into the selected table. The reader can be either a stream of json objects or an array of objects.
func OpenDB ¶
OpenDB is a helper function that takes raw unvalidated parameters and opens a database.
func QueryTables ¶
Types ¶
type BenchOptions ¶
type DumpPebbleOptions ¶
type DumpPebbleOptions struct {
KeysOnly bool
}