chromedp/cdp/database/database.go

126 lines
3.3 KiB
Go
Raw Normal View History

2017-01-24 15:09:23 +00:00
// Package database provides the Chrome Debugging Protocol
// commands, types, and events for the Database domain.
2017-01-24 15:09:23 +00:00
//
// Generated by the chromedp-gen command.
package database
// 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"
)
// 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{}
}
// Do executes Database.disable against the provided context and
// target handler.
func (p *DisableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDatabaseDisable, nil, nil)
2017-01-24 15:09:23 +00:00
}
2017-12-18 00:23:14 +00:00
// EnableParams enables database tracking, database events will now be
// delivered to the client.
type EnableParams struct{}
2017-01-24 15:09:23 +00:00
2017-12-18 00:23:14 +00:00
// Enable enables database tracking, database events will now be delivered to
// the client.
func Enable() *EnableParams {
return &EnableParams{}
2017-01-24 15:09:23 +00:00
}
2017-12-18 00:23:14 +00:00
// Do executes Database.enable against the provided context and
// target handler.
2017-12-18 00:23:14 +00:00
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDatabaseEnable, nil, 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"`
}
// Do executes Database.executeSQL against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
// columnNames
// values
// sqlError
func (p *ExecuteSQLParams) Do(ctxt context.Context, h cdp.Handler) (columnNames []string, values []easyjson.RawMessage, sqlError *Error, err error) {
// 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
}
return res.ColumnNames, res.Values, res.SQLError, nil
2017-01-24 15:09:23 +00:00
}
2017-12-18 00:23:14 +00:00
// GetDatabaseTableNamesParams [no description].
type GetDatabaseTableNamesParams struct {
DatabaseID ID `json:"databaseId"`
}
// GetDatabaseTableNames [no description].
//
// parameters:
// databaseID
func GetDatabaseTableNames(databaseID ID) *GetDatabaseTableNamesParams {
return &GetDatabaseTableNamesParams{
DatabaseID: databaseID,
}
}
// GetDatabaseTableNamesReturns return values.
type GetDatabaseTableNamesReturns struct {
TableNames []string `json:"tableNames,omitempty"`
}
// Do executes Database.getDatabaseTableNames against the provided context and
// target handler.
//
// returns:
// tableNames
func (p *GetDatabaseTableNamesParams) Do(ctxt context.Context, h cdp.Handler) (tableNames []string, err error) {
// execute
var res GetDatabaseTableNamesReturns
err = h.Execute(ctxt, cdp.CommandDatabaseGetDatabaseTableNames, p, &res)
if err != nil {
return nil, err
}
return res.TableNames, nil
}