gistdb

package module
v0.0.0-...-0e1770a Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2020 License: MIT Imports: 4 Imported by: 0

README

gitst-db

My attempt to use gists as the simplest form of online database/datastore

who should use this?

Anybody who is the same special brand of stupid I am Anybody is looking for a datastore that is:

  • simple to set up
  • online
  • free/cheap
  • low volume
  • only handling a single concurrent connection

When should I use this

For the love of whatever diety you pray to do not use this in your production revenue generating systems

I'm writing this for use in a couple of personal projects where I don't want the data stuck on my laptop, but don't really care if the data goes caput

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	// contains filtered or unexported fields
}

Connection is the handle for all access to the Gists

func NewConnection

func NewConnection(pat string, gistid string) (*Connection, error)

NewConnection creates a new Connection to the listed gist, returning error if the id cannot be found

func (Connection) FindOne

func (c Connection) FindOne(filename string) (string, error)

FindOne returns the single named file from the gist if it exists. Returns an error file doesn't exist

func (*Connection) Insert

func (c *Connection) Insert(filename string, contents string) error

Insert adds a new file to the gist. Returns an error if the file already exists

func (*Connection) UpdateMany

func (c *Connection) UpdateMany(files map[string]string) error

UpdateMany updates many files in the Gist at once. Warning this calls UpdateOne multiple times so is NOT idempotent

func (*Connection) UpdateOne

func (c *Connection) UpdateOne(filename string, contents string) error

UpdateOne updates a single existing file. Returns an error if the file does not currently exist

type GistDb

type GistDb interface {
	Insert(string, string) error
	UpdateOne(string, string) error
	UpdateMany(map[string]string) error
	FindOne(string) (string, error)
}

Directories

Path Synopsis
Package mock_gistdb is a generated GoMock package.
Package mock_gistdb is a generated GoMock package.

Jump to

Keyboard shortcuts

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