all repos — litestore @ f7ced18ec6fa373d59cc3757efc359e1738a4cfc

A minimalist nosql document store.

Improved API (managed null values, using underscores in properties).
h3rald h3rald@h3rald.com
Sun, 03 May 2015 14:47:10 +0200
commit

f7ced18ec6fa373d59cc3757efc359e1738a4cfc

parent

a4dcbc3187b7e2c58c09e833f9ba4359e2827f71

4 files changed, 10 insertions(+), 7 deletions(-)

jump to
M admin/js/modules/info.jsadmin/js/modules/info.js

@@ -19,7 +19,7 @@ var readonly = info.read_only ? m("span.label.label-success", "Yes") : m("span.label.label-danger", "No");

var infolist = m(".col-sm-6", [m("ul.list-unstyled", [ li("Version", info.version), li("Size", info.size), - li("Mounted Directory", info.directory, info.directory.length===0), + li("Mounted Directory", info.directory, info.directory === null), li("Log Level", info.log_level), li("Read-Only", readonly), li("Total Documents", m("span.badge", info.total_documents)),
M lib/api_v1.nimlib/api_v1.nim

@@ -1,5 +1,5 @@

import asynchttpserver2, asyncdispatch, strutils, cgi, strtabs, pegs, json, os, times -import types, core, utils +import types, core, utils, logger # Helper procs

@@ -170,7 +170,7 @@ content["offset"] = %orig_offset

if options.orderby != "": content["sort"] = %options.orderby content["total"] = %total - content["execution-time"] = %(cputime()-t0) + content["execution_time"] = %(cputime()-t0) content["results"] = docs result.headers = ctJsonHeader() result.content = content.pretty

@@ -185,7 +185,10 @@ content["version"] = %(LS.appname & " v" & LS.appversion)

content["size"] = %($((LS.file.getFileSize().float/(1024*1024)).formatFloat(ffDecimal, 2)) & " MB") content["read_only"] = %LS.readonly content["log_level"] = %LS.loglevel - content["directory"] = %LS.directory + if LS.directory == nil: + content["directory"] = newJNull() + else: + content["directory"] = %LS.directory content["mount"] = %LS.mount content["total_documents"] = %total_docs content["total_tags"] = %total_tags
M lib/cli.nimlib/cli.nim

@@ -17,8 +17,7 @@ port*: int

operation = opRun directory:string = nil readonly = false - logLevelLabel = "INFO" - #logLevel = lvlInfo + logLevel = "info" mount = false reset = false

@@ -126,6 +125,7 @@ of "none":

LOG.level = lvNone else: fail(103, "Invalid log level '$1'" % val) + loglevel = val of "directory", "d": if val == "": fail(104, "Directory not specified.")

@@ -162,5 +162,6 @@ LS.appversion = version

LS.readonly = readonly LS.appname = appname LS.favicon = favicon +LS.loglevel = loglevel LS.mount = mount LS.reset = reset
M lib/core.nimlib/core.nim

@@ -9,7 +9,6 @@ pegs,

strtabs, strutils, base64, - #logging, math import types,