chromedp/cdp/database/database.go

126 lines
3.3 KiB
Go

// Package database provides the Chrome Debugging Protocol
// commands, types, and events for the Database domain.
//
// Generated by the chromedp-gen command.
package database
// Code generated by chromedp-gen. DO NOT EDIT.
import (
"context"
cdp "github.com/knq/chromedp/cdp"
"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{}
}
// Do executes Database.enable against the provided context and
// target handler.
func (p *EnableParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
return h.Execute(ctxt, cdp.CommandDatabaseEnable, nil, nil)
}
// 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)
}
// 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
}
// ExecuteSQLParams [no description].
type ExecuteSQLParams struct {
DatabaseID ID `json:"databaseId"`
Query string `json:"query"`
}
// ExecuteSQL [no description].
//
// parameters:
// databaseID
// query
func ExecuteSQL(databaseID ID, query string) *ExecuteSQLParams {
return &ExecuteSQLParams{
DatabaseID: databaseID,
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.
//
// 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)
if err != nil {
return nil, nil, nil, err
}
return res.ColumnNames, res.Values, res.SQLError, nil
}