Apache H2 Database driver for Go

Oh yeah! The H2 SQL Driver for Go is here at last!

Introduction

Apache H2 is a light weight and high performance SQL Database written in Java.

Motivation

Some months ago, I worked in a “tech debt” project where a lot of business logic was coded as SQL sentences.

Let’s do it

It have been my first Go SQL driver.

Hello world, H2!

The following example demonstrate how to use the H2 SQL Go driver.

The repository

Here is the respository: https://github.com/jmrobles/h2go

Features

  • Support of basic types: string, float, double, short, long, date, time, timestamp, timezones, …
  • Basic testing with CI (GitHub Action)
  • Prepared Statements
  • Parametrized DML statements(parameter symbol: ?)
  • Transaction support.
  • Logging with different levels.

Roadmap

  • Implementation of complex types: UUID, JSON, Blob, etc.
  • MultiResultSet support.
  • Older Go versions compatibility.
  • Other H2 version support.
  • More tests.
  • Benchmark tests.

Conclusion

The development of the driver has been very didactic. The most difficult part was analyzing and implementing the protocol due to the lack of internal documentation.

Related posts

Thanks so much! =D

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
JM Robles

JM Robles

Backend Platform engineer #go #python #kubernetes #terraform #devops