0.3.1 • Published 1 year ago

@gasstack/kv v0.3.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@gasstack/kv

The package is meant to allow the creation and usage of key-value store in Google App Script applications.

Description

The package allows create basic managed (handling serialization and deserialization) KV store using Properties, Spreadsheets, Documents, etc.

Usage

It is possible to create a KV store from a property store:

const kv = createPropertiesStore(PropertiesService.getDocumentProperties());

kv.set("obj", { name: "test", value: 10 });

console.log(kv.get("obj").value);

It is possible to create a KV store from a cache:

const kv = createCacheStore(CacheService.getDocumentCache());

kv.set("obj", { name: "test", value: 10 });

console.log(kv.get("obj").value);

It is possible to create a KV store from a Spreadsheet range:

const kv = createSpreadsheetStore(
  SpreadsheetApp.getActive()
    .getRange("B1:C1")
    .getDataRegion(SpreadsheetApp.Dimension.ROWS)
);

kv.set("obj", { name: "test", value: 10 });

console.log(kv.get("obj").value);

Example

Have a look to the e2e test.

API

API Reference

0.3.1

1 year ago

0.3.0

1 year ago

0.2.0

1 year ago

0.1.0

1 year ago