1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418
|
// Package indexeddb provides the Chrome DevTools Protocol
// commands, types, and events for the IndexedDB domain.
//
// Generated by the cdproto-gen command.
package indexeddb
// Code generated by cdproto-gen. DO NOT EDIT.
import (
"context"
"github.com/chromedp/cdproto/cdp"
)
// ClearObjectStoreParams clears all entries from an object store.
type ClearObjectStoreParams struct {
SecurityOrigin string `json:"securityOrigin,omitempty"` // At least and at most one of securityOrigin, storageKey must be specified. Security origin.
StorageKey string `json:"storageKey,omitempty"` // Storage key.
DatabaseName string `json:"databaseName"` // Database name.
ObjectStoreName string `json:"objectStoreName"` // Object store name.
}
// ClearObjectStore clears all entries from an object store.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB#method-clearObjectStore
//
// parameters:
//
// databaseName - Database name.
// objectStoreName - Object store name.
func ClearObjectStore(databaseName string, objectStoreName string) *ClearObjectStoreParams {
return &ClearObjectStoreParams{
DatabaseName: databaseName,
ObjectStoreName: objectStoreName,
}
}
// WithSecurityOrigin at least and at most one of securityOrigin, storageKey
// must be specified. Security origin.
func (p ClearObjectStoreParams) WithSecurityOrigin(securityOrigin string) *ClearObjectStoreParams {
p.SecurityOrigin = securityOrigin
return &p
}
// WithStorageKey storage key.
func (p ClearObjectStoreParams) WithStorageKey(storageKey string) *ClearObjectStoreParams {
p.StorageKey = storageKey
return &p
}
// Do executes IndexedDB.clearObjectStore against the provided context.
func (p *ClearObjectStoreParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandClearObjectStore, p, nil)
}
// DeleteDatabaseParams deletes a database.
type DeleteDatabaseParams struct {
SecurityOrigin string `json:"securityOrigin,omitempty"` // At least and at most one of securityOrigin, storageKey must be specified. Security origin.
StorageKey string `json:"storageKey,omitempty"` // Storage key.
DatabaseName string `json:"databaseName"` // Database name.
}
// DeleteDatabase deletes a database.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB#method-deleteDatabase
//
// parameters:
//
// databaseName - Database name.
func DeleteDatabase(databaseName string) *DeleteDatabaseParams {
return &DeleteDatabaseParams{
DatabaseName: databaseName,
}
}
// WithSecurityOrigin at least and at most one of securityOrigin, storageKey
// must be specified. Security origin.
func (p DeleteDatabaseParams) WithSecurityOrigin(securityOrigin string) *DeleteDatabaseParams {
p.SecurityOrigin = securityOrigin
return &p
}
// WithStorageKey storage key.
func (p DeleteDatabaseParams) WithStorageKey(storageKey string) *DeleteDatabaseParams {
p.StorageKey = storageKey
return &p
}
// Do executes IndexedDB.deleteDatabase against the provided context.
func (p *DeleteDatabaseParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandDeleteDatabase, p, nil)
}
// DeleteObjectStoreEntriesParams delete a range of entries from an object
// store.
type DeleteObjectStoreEntriesParams struct {
SecurityOrigin string `json:"securityOrigin,omitempty"` // At least and at most one of securityOrigin, storageKey must be specified. Security origin.
StorageKey string `json:"storageKey,omitempty"` // Storage key.
DatabaseName string `json:"databaseName"`
ObjectStoreName string `json:"objectStoreName"`
KeyRange *KeyRange `json:"keyRange"` // Range of entry keys to delete
}
// DeleteObjectStoreEntries delete a range of entries from an object store.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB#method-deleteObjectStoreEntries
//
// parameters:
//
// databaseName
// objectStoreName
// keyRange - Range of entry keys to delete
func DeleteObjectStoreEntries(databaseName string, objectStoreName string, keyRange *KeyRange) *DeleteObjectStoreEntriesParams {
return &DeleteObjectStoreEntriesParams{
DatabaseName: databaseName,
ObjectStoreName: objectStoreName,
KeyRange: keyRange,
}
}
// WithSecurityOrigin at least and at most one of securityOrigin, storageKey
// must be specified. Security origin.
func (p DeleteObjectStoreEntriesParams) WithSecurityOrigin(securityOrigin string) *DeleteObjectStoreEntriesParams {
p.SecurityOrigin = securityOrigin
return &p
}
// WithStorageKey storage key.
func (p DeleteObjectStoreEntriesParams) WithStorageKey(storageKey string) *DeleteObjectStoreEntriesParams {
p.StorageKey = storageKey
return &p
}
// Do executes IndexedDB.deleteObjectStoreEntries against the provided context.
func (p *DeleteObjectStoreEntriesParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandDeleteObjectStoreEntries, p, nil)
}
// DisableParams disables events from backend.
type DisableParams struct{}
// Disable disables events from backend.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB#method-disable
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes IndexedDB.disable against the provided context.
func (p *DisableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandDisable, nil, nil)
}
// EnableParams enables events from backend.
type EnableParams struct{}
// Enable enables events from backend.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB#method-enable
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes IndexedDB.enable against the provided context.
func (p *EnableParams) Do(ctx context.Context) (err error) {
return cdp.Execute(ctx, CommandEnable, nil, nil)
}
// RequestDataParams requests data from object store or index.
type RequestDataParams struct {
SecurityOrigin string `json:"securityOrigin,omitempty"` // At least and at most one of securityOrigin, storageKey must be specified. Security origin.
StorageKey string `json:"storageKey,omitempty"` // Storage key.
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.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB#method-requestData
//
// parameters:
//
// 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(databaseName string, objectStoreName string, indexName string, skipCount int64, pageSize int64) *RequestDataParams {
return &RequestDataParams{
DatabaseName: databaseName,
ObjectStoreName: objectStoreName,
IndexName: indexName,
SkipCount: skipCount,
PageSize: pageSize,
}
}
// WithSecurityOrigin at least and at most one of securityOrigin, storageKey
// must be specified. Security origin.
func (p RequestDataParams) WithSecurityOrigin(securityOrigin string) *RequestDataParams {
p.SecurityOrigin = securityOrigin
return &p
}
// WithStorageKey storage key.
func (p RequestDataParams) WithStorageKey(storageKey string) *RequestDataParams {
p.StorageKey = storageKey
return &p
}
// 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.
}
// Do executes IndexedDB.requestData against the provided context.
//
// returns:
//
// objectStoreDataEntries - Array of object store data entries.
// hasMore - If true, there are more entries to fetch in the given range.
func (p *RequestDataParams) Do(ctx context.Context) (objectStoreDataEntries []*DataEntry, hasMore bool, err error) {
// execute
var res RequestDataReturns
err = cdp.Execute(ctx, CommandRequestData, p, &res)
if err != nil {
return nil, false, err
}
return res.ObjectStoreDataEntries, res.HasMore, nil
}
// GetMetadataParams gets metadata of an object store.
type GetMetadataParams struct {
SecurityOrigin string `json:"securityOrigin,omitempty"` // At least and at most one of securityOrigin, storageKey must be specified. Security origin.
StorageKey string `json:"storageKey,omitempty"` // Storage key.
DatabaseName string `json:"databaseName"` // Database name.
ObjectStoreName string `json:"objectStoreName"` // Object store name.
}
// GetMetadata gets metadata of an object store.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB#method-getMetadata
//
// parameters:
//
// databaseName - Database name.
// objectStoreName - Object store name.
func GetMetadata(databaseName string, objectStoreName string) *GetMetadataParams {
return &GetMetadataParams{
DatabaseName: databaseName,
ObjectStoreName: objectStoreName,
}
}
// WithSecurityOrigin at least and at most one of securityOrigin, storageKey
// must be specified. Security origin.
func (p GetMetadataParams) WithSecurityOrigin(securityOrigin string) *GetMetadataParams {
p.SecurityOrigin = securityOrigin
return &p
}
// WithStorageKey storage key.
func (p GetMetadataParams) WithStorageKey(storageKey string) *GetMetadataParams {
p.StorageKey = storageKey
return &p
}
// GetMetadataReturns return values.
type GetMetadataReturns struct {
EntriesCount float64 `json:"entriesCount,omitempty"` // the entries count
KeyGeneratorValue float64 `json:"keyGeneratorValue,omitempty"` // the current value of key generator, to become the next inserted key into the object store. Valid if objectStore.autoIncrement is true.
}
// Do executes IndexedDB.getMetadata against the provided context.
//
// returns:
//
// entriesCount - the entries count
// keyGeneratorValue - the current value of key generator, to become the next inserted key into the object store. Valid if objectStore.autoIncrement is true.
func (p *GetMetadataParams) Do(ctx context.Context) (entriesCount float64, keyGeneratorValue float64, err error) {
// execute
var res GetMetadataReturns
err = cdp.Execute(ctx, CommandGetMetadata, p, &res)
if err != nil {
return 0, 0, err
}
return res.EntriesCount, res.KeyGeneratorValue, nil
}
// RequestDatabaseParams requests database with given name in given frame.
type RequestDatabaseParams struct {
SecurityOrigin string `json:"securityOrigin,omitempty"` // At least and at most one of securityOrigin, storageKey must be specified. Security origin.
StorageKey string `json:"storageKey,omitempty"` // Storage key.
DatabaseName string `json:"databaseName"` // Database name.
}
// RequestDatabase requests database with given name in given frame.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB#method-requestDatabase
//
// parameters:
//
// databaseName - Database name.
func RequestDatabase(databaseName string) *RequestDatabaseParams {
return &RequestDatabaseParams{
DatabaseName: databaseName,
}
}
// WithSecurityOrigin at least and at most one of securityOrigin, storageKey
// must be specified. Security origin.
func (p RequestDatabaseParams) WithSecurityOrigin(securityOrigin string) *RequestDatabaseParams {
p.SecurityOrigin = securityOrigin
return &p
}
// WithStorageKey storage key.
func (p RequestDatabaseParams) WithStorageKey(storageKey string) *RequestDatabaseParams {
p.StorageKey = storageKey
return &p
}
// RequestDatabaseReturns return values.
type RequestDatabaseReturns struct {
DatabaseWithObjectStores *DatabaseWithObjectStores `json:"databaseWithObjectStores,omitempty"` // Database with an array of object stores.
}
// Do executes IndexedDB.requestDatabase against the provided context.
//
// returns:
//
// databaseWithObjectStores - Database with an array of object stores.
func (p *RequestDatabaseParams) Do(ctx context.Context) (databaseWithObjectStores *DatabaseWithObjectStores, err error) {
// execute
var res RequestDatabaseReturns
err = cdp.Execute(ctx, CommandRequestDatabase, p, &res)
if err != nil {
return nil, err
}
return res.DatabaseWithObjectStores, nil
}
// RequestDatabaseNamesParams requests database names for given security
// origin.
type RequestDatabaseNamesParams struct {
SecurityOrigin string `json:"securityOrigin,omitempty"` // At least and at most one of securityOrigin, storageKey must be specified. Security origin.
StorageKey string `json:"storageKey,omitempty"` // Storage key.
}
// RequestDatabaseNames requests database names for given security origin.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/IndexedDB#method-requestDatabaseNames
//
// parameters:
func RequestDatabaseNames() *RequestDatabaseNamesParams {
return &RequestDatabaseNamesParams{}
}
// WithSecurityOrigin at least and at most one of securityOrigin, storageKey
// must be specified. Security origin.
func (p RequestDatabaseNamesParams) WithSecurityOrigin(securityOrigin string) *RequestDatabaseNamesParams {
p.SecurityOrigin = securityOrigin
return &p
}
// WithStorageKey storage key.
func (p RequestDatabaseNamesParams) WithStorageKey(storageKey string) *RequestDatabaseNamesParams {
p.StorageKey = storageKey
return &p
}
// RequestDatabaseNamesReturns return values.
type RequestDatabaseNamesReturns struct {
DatabaseNames []string `json:"databaseNames,omitempty"` // Database names for origin.
}
// Do executes IndexedDB.requestDatabaseNames against the provided context.
//
// returns:
//
// databaseNames - Database names for origin.
func (p *RequestDatabaseNamesParams) Do(ctx context.Context) (databaseNames []string, err error) {
// execute
var res RequestDatabaseNamesReturns
err = cdp.Execute(ctx, CommandRequestDatabaseNames, p, &res)
if err != nil {
return nil, err
}
return res.DatabaseNames, nil
}
// Command names.
const (
CommandClearObjectStore = "IndexedDB.clearObjectStore"
CommandDeleteDatabase = "IndexedDB.deleteDatabase"
CommandDeleteObjectStoreEntries = "IndexedDB.deleteObjectStoreEntries"
CommandDisable = "IndexedDB.disable"
CommandEnable = "IndexedDB.enable"
CommandRequestData = "IndexedDB.requestData"
CommandGetMetadata = "IndexedDB.getMetadata"
CommandRequestDatabase = "IndexedDB.requestDatabase"
CommandRequestDatabaseNames = "IndexedDB.requestDatabaseNames"
)
|