2017-01-24 15:09:23 +00:00
|
|
|
// Package database provides the Chrome Debugging Protocol
|
2017-02-12 04:59:33 +00:00
|
|
|
// commands, types, and events for the Database domain.
|
2017-01-24 15:09:23 +00:00
|
|
|
//
|
|
|
|
// Generated by the chromedp-gen command.
|
|
|
|
package database
|
|
|
|
|
2017-07-09 02:05:19 +00:00
|
|
|
// Code generated by chromedp-gen. DO NOT EDIT.
|
2017-01-24 15:09:23 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2017-01-26 07:28:34 +00:00
|
|
|
cdp "github.com/knq/chromedp/cdp"
|
2017-01-24 15:09:23 +00:00
|
|
|
"github.com/mailru/easyjson"
|
|
|
|
)
|
|
|
|
|
|
|
|
// EnableParams enables database tracking, database events will now be
|
|
|
|
// delivered to the client.
|
|
|
|
type EnableParams struct{}
|
|
|
|
|
|
|
|
// Enable enables database tracking, database events will now be delivered to
|
|
|
|
// the client.
|
|
|
|
func Enable() *EnableParams {
|
|
|
|
return &EnableParams{}
|
|
|
|
}
|
|
|
|
|
2017-02-12 04:59:33 +00:00
|
|
|
// Do executes Database.enable against the provided context and
|
|
|
|
// target handler.
|
|
|
|
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
2017-02-14 08:41:23 +00:00
|
|
|
return h.Execute(ctxt, cdp.CommandDatabaseEnable, nil, nil)
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// DisableParams disables database tracking, prevents database events from
|
|
|
|
// being sent to the client.
|
|
|
|
type DisableParams struct{}
|
|
|
|
|
|
|
|
// Disable disables database tracking, prevents database events from being
|
|
|
|
// sent to the client.
|
|
|
|
func Disable() *DisableParams {
|
|
|
|
return &DisableParams{}
|
|
|
|
}
|
|
|
|
|
2017-02-12 04:59:33 +00:00
|
|
|
// Do executes Database.disable against the provided context and
|
|
|
|
// target handler.
|
|
|
|
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
2017-02-14 08:41:23 +00:00
|
|
|
return h.Execute(ctxt, cdp.CommandDatabaseDisable, nil, nil)
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
2017-01-26 07:28:34 +00:00
|
|
|
// GetDatabaseTableNamesParams [no description].
|
2017-01-24 15:09:23 +00:00
|
|
|
type GetDatabaseTableNamesParams struct {
|
2017-01-26 07:28:34 +00:00
|
|
|
DatabaseID ID `json:"databaseId"`
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
2017-01-26 07:28:34 +00:00
|
|
|
// GetDatabaseTableNames [no description].
|
|
|
|
//
|
2017-01-24 15:09:23 +00:00
|
|
|
// parameters:
|
2017-01-26 07:28:34 +00:00
|
|
|
// databaseID
|
|
|
|
func GetDatabaseTableNames(databaseID ID) *GetDatabaseTableNamesParams {
|
2017-01-24 15:09:23 +00:00
|
|
|
return &GetDatabaseTableNamesParams{
|
2017-01-26 07:28:34 +00:00
|
|
|
DatabaseID: databaseID,
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetDatabaseTableNamesReturns return values.
|
|
|
|
type GetDatabaseTableNamesReturns struct {
|
|
|
|
TableNames []string `json:"tableNames,omitempty"`
|
|
|
|
}
|
|
|
|
|
2017-02-12 04:59:33 +00:00
|
|
|
// Do executes Database.getDatabaseTableNames against the provided context and
|
|
|
|
// target handler.
|
2017-01-24 15:09:23 +00:00
|
|
|
//
|
|
|
|
// returns:
|
|
|
|
// tableNames
|
2017-02-12 04:59:33 +00:00
|
|
|
func (p *GetDatabaseTableNamesParams) Do(ctxt context.Context, h cdp.Handler) (tableNames []string, err error) {
|
2017-02-14 08:41:23 +00:00
|
|
|
// execute
|
|
|
|
var res GetDatabaseTableNamesReturns
|
|
|
|
err = h.Execute(ctxt, cdp.CommandDatabaseGetDatabaseTableNames, p, &res)
|
2017-01-24 15:09:23 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
2017-02-14 08:41:23 +00:00
|
|
|
return res.TableNames, nil
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
2017-01-26 07:28:34 +00:00
|
|
|
// ExecuteSQLParams [no description].
|
2017-01-24 15:09:23 +00:00
|
|
|
type ExecuteSQLParams struct {
|
2017-01-26 07:28:34 +00:00
|
|
|
DatabaseID ID `json:"databaseId"`
|
|
|
|
Query string `json:"query"`
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
2017-01-26 07:28:34 +00:00
|
|
|
// ExecuteSQL [no description].
|
|
|
|
//
|
2017-01-24 15:09:23 +00:00
|
|
|
// parameters:
|
2017-01-26 07:28:34 +00:00
|
|
|
// databaseID
|
2017-01-24 15:09:23 +00:00
|
|
|
// query
|
2017-01-26 07:28:34 +00:00
|
|
|
func ExecuteSQL(databaseID ID, query string) *ExecuteSQLParams {
|
2017-01-24 15:09:23 +00:00
|
|
|
return &ExecuteSQLParams{
|
2017-01-26 07:28:34 +00:00
|
|
|
DatabaseID: databaseID,
|
2017-01-24 15:09:23 +00:00
|
|
|
Query: query,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ExecuteSQLReturns return values.
|
|
|
|
type ExecuteSQLReturns struct {
|
|
|
|
ColumnNames []string `json:"columnNames,omitempty"`
|
|
|
|
Values []easyjson.RawMessage `json:"values,omitempty"`
|
|
|
|
SQLError *Error `json:"sqlError,omitempty"`
|
|
|
|
}
|
|
|
|
|
2017-02-12 04:59:33 +00:00
|
|
|
// Do executes Database.executeSQL against the provided context and
|
|
|
|
// target handler.
|
2017-01-24 15:09:23 +00:00
|
|
|
//
|
|
|
|
// returns:
|
|
|
|
// columnNames
|
|
|
|
// values
|
|
|
|
// sqlError
|
2017-02-12 04:59:33 +00:00
|
|
|
func (p *ExecuteSQLParams) Do(ctxt context.Context, h cdp.Handler) (columnNames []string, values []easyjson.RawMessage, sqlError *Error, err error) {
|
2017-02-14 08:41:23 +00:00
|
|
|
// execute
|
|
|
|
var res ExecuteSQLReturns
|
|
|
|
err = h.Execute(ctxt, cdp.CommandDatabaseExecuteSQL, p, &res)
|
2017-01-24 15:09:23 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, nil, nil, err
|
|
|
|
}
|
|
|
|
|
2017-02-14 08:41:23 +00:00
|
|
|
return res.ColumnNames, res.Values, res.SQLError, nil
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|