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"
)
// 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)
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{}
}
// 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-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"`
}
// Do executes Database.getDatabaseTableNames against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// 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)
2017-01-24 15:09:23 +00:00
if err != nil {
return nil, err
}
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"`
}
// 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
}