← Back to Tech Radar
Hacker News tech

PostgreSQL Extensions in Go

Trending on Hacker News: PostgreSQL Extensions in Go (95 points / 11 comments, via jespino.github.io)

In one line

Build PostgreSQL extensions from plain Go code, using TinyGo: functions marked with //gopgext:function become SQL functions.

Opening excerpt

gopgext builds PostgreSQL extensions from plain Go code, using TinyGo. Mark a function with //gopgext:function and it becomes a SQL function: gopgext writes the C glue, the install script and the control file.

A project is plain Go files. The standard library works: fmt , regexp , encoding/json , crypto/* , maps, generics, iterators, defer / recover .

Strings, numbers, arrays, NULL s, sets, rows, timestamps, UUIDs and JSON map to SQL types. Define your own data types and composite types in Go.

Run SQL through SPI, return errors with SQLSTATE codes, log, read settings and stay responsive to query cancellation.

(Excerpted from the original; full article via the source link below.)

This story hit the Hacker News front page today (95 points / 11 comments, via jespino.github.io). Our Tech Radar aggregates daily signals on AI engineering, backend architecture and DevOps — browse the related services and further reading below, or get in touch with our team.

Source: Hacker News

Related Services

Related Reading