Skip to content

tmac33/golang-bigtable-sample

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CRUD for Hotel

Install Bigtable Emulator

gcloud components install bigtable

Install cbt tool

gcloud components install cbt

Start emulator

gcloud beta emulators bigtable start --host-port=localhost:8086

Create a table and column family

In a different console:

export BIGTABLE_EMULATOR_HOST=localhost:8086
cbt -project "project-id" -instance "bus-instance" createtable hotels
cbt -project "project-id" -instance "bus-instance" createfamily hotels hotel_details

Check if table exists

cbt -project "project-id" -instance "bus-instance" ls
cbt -project "project-id" -instance "bus-instance" read hotels

Populate Data

export BIGTABLE_EMULATOR_HOST=localhost:8086
cd write
go run writeRecords.go

Ensure data shows up in the table

cbt -project "project-id" -instance "bus-instance" ls
cbt -project "project-id" -instance "bus-instance" read hotels

Read Records

export BIGTABLE_EMULATOR_HOST=localhost:8086
cd read
go run readRecords.go -zip or-01

About

Demonstrates using bigtable with golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%