gopgext develops PostgreSQL extensions from plain Go code, utilizing TinyGo. Mark a function with and it ends up being a SQL function: gopgext composes the C glue, the set up script and the control file. 19659003 Speculative gopgext is speculative. Do not utilize it in production: a bug in the produced code or the Go runtime runs inside the server, where it can crash it or corrupt information, and the API and produced SQL might alter without notification. Simply Go 19659005 A task appears Go files. The basic library works: 19459024, , , , maps, generics, iterators, / Types map to SQL 19659007 Strings, numbers, selections, s, sets, rows, timestamps, UUIDs and JSON map to SQL types. Specify your own information types and composite key ins Go. Questions and mistakes 19659009 Run SQL through SPI, return mistakes with SQLSTATE codes, log, checked out settings and remain responsive to query cancellation. Beyond functions Compose triggers, aggregates, GiST, GIN, SP-GiST and BRIN operator classes, index gain access to techniques, foreign information wrappers and question hooks. 19659012 Shown on contrib 19659013 Ports of PostgreSQL’s contrib modules ( 19459031, , , 19459034, …) pass upstream’s regression tests. Safe coexistence 19659015 Numerous Go extensions load in one backend. PostgreSQL mistakes never ever loosen up through Go frames, and outcomes are copied into PostgreSQL memory. 19659016 Hey there, world # 19659018 plan primary 19659020 import 19659021 ( 19659023// Hello returns a welcoming for name. // // gopgext: function immutable parallel=safe func Hey there 19659028 ( 19659029 name string 19659031 string 19659033 return 19659035 + name + 19659038 // Shout upper-cases s. An empty string raises a mistake. 19659040// 19659041// gopgext: function immutable parallel=safe func 19659043 Scream ( 19659045 s string 19659047 19659048 ( string , mistake 19659052 19659053 19659081 func 19659082 primary () 19659084 19659085// runs when per backend, when PostgreSQL loads the library 19659086 gopgext init hey there # produces hello/go. mod and hello/main. go 19659088 gopgext set up hi 19459046 # develops hello.so, hello.control, hey there-- 1.0.sql and installs them 19659089 psql -c 'CREATE EXTENSION hi' 19459047 -c # hi 19659091 # --------------- # Hello, world! 19659093 The guide strolls through it step by action. A brother or sister task # gopgext utilizes the exact same technique as gokm, which constructs Linux kernel modules from Go: a customized TinyGo target and runtime layer for the host, a C runtime put together by the host's own develop system (PGXS here, kbuild there), and created glue. 19659095
Related
Discover more from PMN S.P.O.R.T.S - A PRIME MEDIA NETWORK BRAND
Subscribe to get the latest posts sent to your email.