gokvc: github.com/mmirolim/gokvc/api Index | Files

package api

import "github.com/mmirolim/gokvc/api"


Package Files

dic.go list.go router.go string.go


const (
    PING = "/ping" // ping api
    // system
    EXPVAR = "/expvar"

    // kv commands
    SGET  = "/get"  // GET key
    SDEL  = "/del"  // DEL key
    SSET  = "/set"  // SET key val
    STTL  = "/ttl"  // TTL key gets seconds left o expire
    SKEYS = "/keys" // SKEYS gets all keys of strings
    SLEN  = "/slen" // SLEN gets number of string elements

    // list commands
    LGET  = "/lget"  // LGET key get all list
    LDEL  = "/ldel"  // LDEL key deletes list
    LPUSH = "/lpush" // LPUSH key val prepends list with element
    LPOP  = "/lpop"  // LPOP key removes and returns the first element of the list stored at key
    LTTL  = "/lttl"  // TTL key gets seconds left o expire
    LKEYS = "/lkeys" // LKEYS gets all keys of lists
    LLEN  = "/llen"  // LLEN gets number of list elements

    // dictionary commands
    DGET  = "/dget"  // DGET key get all field from dic
    DDEL  = "/ddel"  // DDEL key delete dic
    DFGET = "/dfget" // DKGET key field get field from dic
    DFDEL = "/dfdel" // DKDEL key field delete field in dic
    DFSET = "/dfset" // DKSET key field val sets field in dic to val
    DTTL  = "/dttl"  // TTL key gets seconds left o expire
    DKEYS = "/dkeys" // DKEYS gets all keys of dics
    DLEN  = "/dlen"  // DLEN return number of dic elements


var (
    // get params
    PKEY = []byte("k") // param holding key name
    PFLD = []byte("f") // param holding field name used in dic cmds
    PVAL = []byte("v") // param holding value
    PTTL = []byte("t") // param holding ttl

    PONG = []byte("pong") // ping response

    HTTP_CACHE_CONTROL = []byte("Cache-control")
    HTTP_NO_CACHE      = []byte("private, max-age=0, no-cache")
    OK                 = []byte("OK")

    HandlersMap = map[string]fasthttp.RequestHandler{
        PING:   ping,
        SGET:   get,
        SSET:   set,
        SDEL:   del,
        STTL:   sttl,
        SKEYS:  skeys,
        SLEN:   slen,
        LGET:   lget,
        LPUSH:  lpush,
        LPOP:   lpop,
        LDEL:   ldel,
        LKEYS:  lkeys,
        LLEN:   llen,
        LTTL:   lttl,
        DGET:   dget,
        DFGET:  dfget,
        DFSET:  dfset,
        DFDEL:  dfdel,
        DDEL:   ddel,
        DTTL:   dttl,
        DKEYS:  dkeys,
        DLEN:   dlen,
        EXPVAR: expvarhandler.ExpvarHandler,

func New Uses

func New() fasthttp.RequestHandler

Package api imports 7 packages (graph) and is imported by 1 packages. Updated 2016-07-31. Refresh now. Tools for package owners.