2017-01-24 15:09:23 +00:00
|
|
|
// Package indexeddb provides the Chrome Debugging Protocol
|
2017-02-12 04:59:33 +00:00
|
|
|
// commands, types, and events for the IndexedDB domain.
|
2017-01-24 15:09:23 +00:00
|
|
|
//
|
|
|
|
// Generated by the chromedp-gen command.
|
|
|
|
package indexeddb
|
|
|
|
|
|
|
|
// AUTOGENERATED. DO NOT EDIT.
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2017-01-26 07:28:34 +00:00
|
|
|
cdp "github.com/knq/chromedp/cdp"
|
2017-01-24 15:09:23 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// EnableParams enables events from backend.
|
|
|
|
type EnableParams struct{}
|
|
|
|
|
|
|
|
// Enable enables events from backend.
|
|
|
|
func Enable() *EnableParams {
|
|
|
|
return &EnableParams{}
|
|
|
|
}
|
|
|
|
|
2017-02-12 04:59:33 +00:00
|
|
|
// Do executes IndexedDB.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.CommandIndexedDBEnable, nil, nil)
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// DisableParams disables events from backend.
|
|
|
|
type DisableParams struct{}
|
|
|
|
|
|
|
|
// Disable disables events from backend.
|
|
|
|
func Disable() *DisableParams {
|
|
|
|
return &DisableParams{}
|
|
|
|
}
|
|
|
|
|
2017-02-12 04:59:33 +00:00
|
|
|
// Do executes IndexedDB.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.CommandIndexedDBDisable, nil, nil)
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// RequestDatabaseNamesParams requests database names for given security
|
|
|
|
// origin.
|
|
|
|
type RequestDatabaseNamesParams struct {
|
|
|
|
SecurityOrigin string `json:"securityOrigin"` // Security origin.
|
|
|
|
}
|
|
|
|
|
|
|
|
// RequestDatabaseNames requests database names for given security origin.
|
|
|
|
//
|
|
|
|
// parameters:
|
|
|
|
// securityOrigin - Security origin.
|
|
|
|
func RequestDatabaseNames(securityOrigin string) *RequestDatabaseNamesParams {
|
|
|
|
return &RequestDatabaseNamesParams{
|
|
|
|
SecurityOrigin: securityOrigin,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// RequestDatabaseNamesReturns return values.
|
|
|
|
type RequestDatabaseNamesReturns struct {
|
|
|
|
DatabaseNames []string `json:"databaseNames,omitempty"` // Database names for origin.
|
|
|
|
}
|
|
|
|
|
2017-02-12 04:59:33 +00:00
|
|
|
// Do executes IndexedDB.requestDatabaseNames against the provided context and
|
|
|
|
// target handler.
|
2017-01-24 15:09:23 +00:00
|
|
|
//
|
|
|
|
// returns:
|
|
|
|
// databaseNames - Database names for origin.
|
2017-02-12 04:59:33 +00:00
|
|
|
func (p *RequestDatabaseNamesParams) Do(ctxt context.Context, h cdp.Handler) (databaseNames []string, err error) {
|
2017-02-14 08:41:23 +00:00
|
|
|
// execute
|
|
|
|
var res RequestDatabaseNamesReturns
|
|
|
|
err = h.Execute(ctxt, cdp.CommandIndexedDBRequestDatabaseNames, 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.DatabaseNames, nil
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// RequestDatabaseParams requests database with given name in given frame.
|
|
|
|
type RequestDatabaseParams struct {
|
|
|
|
SecurityOrigin string `json:"securityOrigin"` // Security origin.
|
|
|
|
DatabaseName string `json:"databaseName"` // Database name.
|
|
|
|
}
|
|
|
|
|
|
|
|
// RequestDatabase requests database with given name in given frame.
|
|
|
|
//
|
|
|
|
// parameters:
|
|
|
|
// securityOrigin - Security origin.
|
|
|
|
// databaseName - Database name.
|
|
|
|
func RequestDatabase(securityOrigin string, databaseName string) *RequestDatabaseParams {
|
|
|
|
return &RequestDatabaseParams{
|
|
|
|
SecurityOrigin: securityOrigin,
|
|
|
|
DatabaseName: databaseName,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// RequestDatabaseReturns return values.
|
|
|
|
type RequestDatabaseReturns struct {
|
|
|
|
DatabaseWithObjectStores *DatabaseWithObjectStores `json:"databaseWithObjectStores,omitempty"` // Database with an array of object stores.
|
|
|
|
}
|
|
|
|
|
2017-02-12 04:59:33 +00:00
|
|
|
// Do executes IndexedDB.requestDatabase against the provided context and
|
|
|
|
// target handler.
|
2017-01-24 15:09:23 +00:00
|
|
|
//
|
|
|
|
// returns:
|
|
|
|
// databaseWithObjectStores - Database with an array of object stores.
|
2017-02-12 04:59:33 +00:00
|
|
|
func (p *RequestDatabaseParams) Do(ctxt context.Context, h cdp.Handler) (databaseWithObjectStores *DatabaseWithObjectStores, err error) {
|
2017-02-14 08:41:23 +00:00
|
|
|
// execute
|
|
|
|
var res RequestDatabaseReturns
|
|
|
|
err = h.Execute(ctxt, cdp.CommandIndexedDBRequestDatabase, 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.DatabaseWithObjectStores, nil
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// RequestDataParams requests data from object store or index.
|
|
|
|
type RequestDataParams struct {
|
|
|
|
SecurityOrigin string `json:"securityOrigin"` // Security origin.
|
|
|
|
DatabaseName string `json:"databaseName"` // Database name.
|
|
|
|
ObjectStoreName string `json:"objectStoreName"` // Object store name.
|
|
|
|
IndexName string `json:"indexName"` // Index name, empty string for object store data requests.
|
|
|
|
SkipCount int64 `json:"skipCount"` // Number of records to skip.
|
|
|
|
PageSize int64 `json:"pageSize"` // Number of records to fetch.
|
|
|
|
KeyRange *KeyRange `json:"keyRange,omitempty"` // Key range.
|
|
|
|
}
|
|
|
|
|
|
|
|
// RequestData requests data from object store or index.
|
|
|
|
//
|
|
|
|
// parameters:
|
|
|
|
// securityOrigin - Security origin.
|
|
|
|
// databaseName - Database name.
|
|
|
|
// objectStoreName - Object store name.
|
|
|
|
// indexName - Index name, empty string for object store data requests.
|
|
|
|
// skipCount - Number of records to skip.
|
|
|
|
// pageSize - Number of records to fetch.
|
|
|
|
func RequestData(securityOrigin string, databaseName string, objectStoreName string, indexName string, skipCount int64, pageSize int64) *RequestDataParams {
|
|
|
|
return &RequestDataParams{
|
|
|
|
SecurityOrigin: securityOrigin,
|
|
|
|
DatabaseName: databaseName,
|
|
|
|
ObjectStoreName: objectStoreName,
|
|
|
|
IndexName: indexName,
|
|
|
|
SkipCount: skipCount,
|
|
|
|
PageSize: pageSize,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// WithKeyRange key range.
|
|
|
|
func (p RequestDataParams) WithKeyRange(keyRange *KeyRange) *RequestDataParams {
|
|
|
|
p.KeyRange = keyRange
|
|
|
|
return &p
|
|
|
|
}
|
|
|
|
|
|
|
|
// RequestDataReturns return values.
|
|
|
|
type RequestDataReturns struct {
|
|
|
|
ObjectStoreDataEntries []*DataEntry `json:"objectStoreDataEntries,omitempty"` // Array of object store data entries.
|
|
|
|
HasMore bool `json:"hasMore,omitempty"` // If true, there are more entries to fetch in the given range.
|
|
|
|
}
|
|
|
|
|
2017-02-12 04:59:33 +00:00
|
|
|
// Do executes IndexedDB.requestData against the provided context and
|
|
|
|
// target handler.
|
2017-01-24 15:09:23 +00:00
|
|
|
//
|
|
|
|
// returns:
|
|
|
|
// objectStoreDataEntries - Array of object store data entries.
|
|
|
|
// hasMore - If true, there are more entries to fetch in the given range.
|
2017-02-12 04:59:33 +00:00
|
|
|
func (p *RequestDataParams) Do(ctxt context.Context, h cdp.Handler) (objectStoreDataEntries []*DataEntry, hasMore bool, err error) {
|
2017-02-14 08:41:23 +00:00
|
|
|
// execute
|
|
|
|
var res RequestDataReturns
|
|
|
|
err = h.Execute(ctxt, cdp.CommandIndexedDBRequestData, p, &res)
|
2017-01-24 15:09:23 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, false, err
|
|
|
|
}
|
|
|
|
|
2017-02-14 08:41:23 +00:00
|
|
|
return res.ObjectStoreDataEntries, res.HasMore, nil
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ClearObjectStoreParams clears all entries from an object store.
|
|
|
|
type ClearObjectStoreParams struct {
|
|
|
|
SecurityOrigin string `json:"securityOrigin"` // Security origin.
|
|
|
|
DatabaseName string `json:"databaseName"` // Database name.
|
|
|
|
ObjectStoreName string `json:"objectStoreName"` // Object store name.
|
|
|
|
}
|
|
|
|
|
|
|
|
// ClearObjectStore clears all entries from an object store.
|
|
|
|
//
|
|
|
|
// parameters:
|
|
|
|
// securityOrigin - Security origin.
|
|
|
|
// databaseName - Database name.
|
|
|
|
// objectStoreName - Object store name.
|
|
|
|
func ClearObjectStore(securityOrigin string, databaseName string, objectStoreName string) *ClearObjectStoreParams {
|
|
|
|
return &ClearObjectStoreParams{
|
|
|
|
SecurityOrigin: securityOrigin,
|
|
|
|
DatabaseName: databaseName,
|
|
|
|
ObjectStoreName: objectStoreName,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-12 04:59:33 +00:00
|
|
|
// Do executes IndexedDB.clearObjectStore against the provided context and
|
|
|
|
// target handler.
|
|
|
|
func (p *ClearObjectStoreParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
2017-02-14 08:41:23 +00:00
|
|
|
return h.Execute(ctxt, cdp.CommandIndexedDBClearObjectStore, p, nil)
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
2017-01-27 03:29:53 +00:00
|
|
|
|
|
|
|
// DeleteDatabaseParams deletes a database.
|
|
|
|
type DeleteDatabaseParams struct {
|
|
|
|
SecurityOrigin string `json:"securityOrigin"` // Security origin.
|
|
|
|
DatabaseName string `json:"databaseName"` // Database name.
|
|
|
|
}
|
|
|
|
|
|
|
|
// DeleteDatabase deletes a database.
|
|
|
|
//
|
|
|
|
// parameters:
|
|
|
|
// securityOrigin - Security origin.
|
|
|
|
// databaseName - Database name.
|
|
|
|
func DeleteDatabase(securityOrigin string, databaseName string) *DeleteDatabaseParams {
|
|
|
|
return &DeleteDatabaseParams{
|
|
|
|
SecurityOrigin: securityOrigin,
|
|
|
|
DatabaseName: databaseName,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-12 04:59:33 +00:00
|
|
|
// Do executes IndexedDB.deleteDatabase against the provided context and
|
|
|
|
// target handler.
|
|
|
|
func (p *DeleteDatabaseParams) Do(ctxt context.Context, h cdp.Handler) (err error) {
|
2017-02-14 08:41:23 +00:00
|
|
|
return h.Execute(ctxt, cdp.CommandIndexedDBDeleteDatabase, p, nil)
|
2017-01-27 03:29:53 +00:00
|
|
|
}
|