database

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: MIT Imports: 12 Imported by: 6

README

Repl.it Database Go client

PkgGoDev

The easiest way to use Repl.it Database from your Go repls. Try it out on Repl.it!

package main

import (
  "fmt"
  "github.com/replit/database-go"
)

func main() {
  database.Set("key", "value")
  val, _ := database.Get("key")
  fmt.Println(val)
  // Output: value
}

View the docs for more info about how to use the client to interact with Database.

Documentation

Overview

Package database provides methods for interacting with Repl.it Database. It just works if used within a repl.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound indicates that the requested key does not exist.

Functions

func Delete

func Delete(key string) error

Delete removes the provided key.

func Get

func Get(key string) (string, error)

Get returns the value for the provided key. It returns ErrNotFound if the key does not exist.

func ListKeys

func ListKeys(prefix string) ([]string, error)

ListKeys returns a slice of all keys that begin with the provided prefix. They are sorted in lexicographic order.

func Set

func Set(key, value string) error

Set creates or updates the provided key with the provided value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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