Golang with rethinkDB

Buyung Hardiansyah
2 min readApr 17, 2020

RethinkDB is an open source distributed data source for realtime web apps with JSON based document. RethinkDB has intuitive query language, parallelized queries, and simple administration tools.

rethinkDB also has modern web UI. located in http://localhost:8080 if you install in local environment.

rethinkDB has its own query language called reQL, rethinkDB query language.

in this post we will explore how to interact rethinkDB with Go language.

first you have to install rethinkDB and follow this instruction :
https://rethinkdb.com/docs/install/

make sure rethinkDB is up & running

Connect to rethinkDB

Create table

create table in rethinkDB. open rethinkDB WEB UI. click the table menu & create your table.

Insert data

create rethinkDB session struct to reuse the session and create user struct for user data.

create function to insert data to user table

Get All Data

now let’s create a function to fetch user data from rethinkDB.

in this function we fetch data from rethinkDB and bind it to user struct and iterate it. you can use filter with this method after .Table() method.

Delete Data

to delete data by ID in rethinkDB with Go.

wrap it up:

in the next part. we will explore how we fetch data from rethinkDB in realtime.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Buyung Hardiansyah
Buyung Hardiansyah

Written by Buyung Hardiansyah

Software Developer -- Golang | Python | PHP | Reactjs | Flutter

No responses yet

Write a response