postlite

package module
v0.0.0-...-3428476 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

README

Postlite Status

Postlite is a network proxy to allow access to remote SQLite databases over the Postgres wire protocol. This allows GUI tools to be used on remote SQLite databases which can make administration easier.

The proxy works by translating Postgres frontend wire messages into SQLite transactions and converting results back into Postgres response wire messages. Many Postgres clients also inspect the pg_catalog to determine system information so Postlite mirrors this catalog by using an attached in-memory database with virtual tables. The proxy also performs minor rewriting on these system queries to convert them to usable SQLite syntax.

Note: This software was a proof of concept of wrapping SQLite with the Postgres wire protocol. It is no longer maintained. You're welcome to fork this project if you're interested in continuing development.

Usage

To use Postlite, execute the command with the directory that contains your SQLite databases:

$ postlite -data-dir /data

On another machine, you can connect via the regular Postgres port of 5432:

$ psql --host HOSTNAME my.db

This will connect you to a SQLite database at the path /data/my.db.

Development

Postlite uses virtual tables to simulate the pg_catalog so you will need to enable the vtable tag when building:

$ go install -tags vtable ./cmd/postlite

Documentation

Index

Constants

View Source
const (
	ServerVersion = "13.0.0"
)

Postgres settings.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	net.Conn
	// contains filtered or unexported fields
}

func (*Conn) Close

func (c *Conn) Close() (err error)

type Server

type Server struct {

	// Bind address to listen to Postgres wire protocol.
	Addr string

	// Directory that holds SQLite databases.
	DataDir string
	// contains filtered or unexported fields
}

func NewServer

func NewServer() *Server

func (*Server) Close

func (s *Server) Close() (err error)

func (*Server) CloseClientConnection

func (s *Server) CloseClientConnection(conn *Conn) (err error)

CloseClientConnection disconnects a Postgres connections.

func (*Server) CloseClientConnections

func (s *Server) CloseClientConnections() (err error)

CloseClientConnections disconnects all Postgres connections.

func (*Server) Open

func (s *Server) Open() (err error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL