firestorekv

command module
v0.0.0-...-f2b3e4a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2021 License: GPL-3.0 Imports: 7 Imported by: 0

README

FirestoreKV

Small CLI tool to store/retrieve key/value pairs in GCP Firestore(in Datastore mode).

How to use it

Accessing the Firestore will require the Service Account with 'Cloud Datastore User' Role granted. Download the Service Account key file and store it as credentials.json.

export GOOGLE_APPLICATION_CREDENTIALS="credentials.json"
export GOOGLE_PROJECT_ID="my_project123"

There are 3 commands implemented: get, put, and clean.

Storing values

The syntax is following:

./firestorekv put <KIND> <KEY> <VALUE>

For example:

./firestorekv put numbers the_number 42
Retrieving values

The syntax is following:

./firestorekv get <KIND> <KEY>

For example:

./firestorekv get numbers the_number
Cleanup old key/value pairs

All key/value pairs get timestamp field during creation/update. This allows to cleanup old entities.

The syntax is following:

./firestorekv clean <TIMESTAMP>

For example:

week_ago=$(date --date="7 days ago" +%s)
./firestorekv clean passwords $week_ago

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL