stellartux / ReplitDatabase.jl

Julia wrapper for Repl.it Database

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ReplitDatabase.jl

Run on Repl.it

A Julia interface to the repl.it database.

Installation

using Pkg
Pkg.add(url="https://github.com/stellartux/ReplitDatabase.jl")

Use

julia> using ReplitDatabase

julia> db # an AbstractDict{String,String} representing the database
ReplitDB()

julia> db["foo"] = "bar" # set "foo"=>"bar" in the database
"bar"

julia> db["baz"] = "qux" # set "baz"=>"qux" in the database
"qux"

julia> db["foo"] # gets the value associated with the key "foo" from the database
"bar" 

julia> keys(db) # get the keys of the database
2-element Array{String,1}:
 "baz"
 "foo"

julia> keys(db, "f") # get the keys filtered by a prefix
1-element Array{String,1}:
 "foo"

julia> db["baz"] = nothing # delete a value from the database

julia> copy!(db, Dict("hello" => "world")) # overwrite the database with a Dict{String,String}
ReplitDB()

julia> empty!(db) # clear the database

About

Julia wrapper for Repl.it Database

License:MIT License


Languages

Language:Julia 100.0%