logo

The SDK to manage Neon SaaS Platform programmatically.

Neon is a fully managed serverless PostgreSQL with a generous free tier. Neon separates storage and compute and offers modern developer features such as serverless, branching, bottomless storage, and more. Neon is open source and written in Rust.

Find more about Neon here.

How to use

Prerequisites

Installation

Add the SDK as a module dependency:

go get github.com/kislerdm/neon-sdk-go

Run to specify the release version:

go get github.com/kislerdm/[email protected]{{.Ver}}

Where {{.Ver}} is the release version.

Example Usage

Codebase to list projects

package main

import (
	"log"

	neon "github.com/kislerdm/neon-sdk-go"
)

func main() {
	client, err := neon.NewClient(neon.WithHTTPClient(neon.NewMockHTTPClient()))
	if err != nil {
		panic(err)
	}

	v, err := client.ListProjects()
	if err != nil {
		panic(err)
	}

	log.Printf("%d projects found", len(v.Projects))
}

Note that a valid Neon API key must be exported as the environment variable NEON_API_KEY.

Terraform provider

The SDK is used as the basis for the terraform provider to manager Neon resources.