1.0.59 • Published 2 years ago

nv-pg-dispersed-cli v1.0.59

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

nv-pg-dispersed-cli

  • cli tool

install

  • npm install nv-pg-dispersed-cli

usage

 #  npm install nv-pg-dispersed-cli -g
 

#creat consts.js

Usage: nv_pg_dispersed_const [options] 
Options:
    -t, --type_ary        if without external specified, auto generate colnames: c0,c1....., t is array of types
    -e, --external        external k t k t....
    -h, --help            usage

#nv_pg_dispersed_const  -t text json text
/*
......
        module.exports = {
            "ENBALE_PRIM_SRCH": false,
            "PRIM_KEY": "id",
            "PRIM_SRCH_TYP": "integer",
            "PRIM_TYP": "integer",
            "INTERNAL_KS": [
                "___alloced___"
            ],
            "INTERNAL_SRCH_TYPS": [
                "bool"
            ],
            "INTERNAL_TYPS": [
                "bool"
            ],
            "INTERNAL_SRCH_DICT": {
                "___alloced___": "bool"
            },
            "INTERNAL_CREAT_DICT": {
                "___alloced___": "bool"
            },
            "DATA_ALIAS_KS": [
                "c0",
                "c1",
                "c2"
            ],
            "DATA_NAME2RNAME": {
                "c0": "c0",
                "c1": "c1",
                "c2": "c2"
            },
            "DATA_RNAME2NAME": {
                "c0": "c0",
                "c1": "c1",
                "c2": "c2"
            },
            "DATA_KS": [
                "c0",
                "c1",
                "c2"
            ],
            "DATA_SRCH_TYPS": [
                "text",
                "json",
                "text"
            ],
            "DATA_TYPS": [
                "text",
                "jsonb",
                "text"
            ],
            "DATA_SRCH_DICT": {
                "c0": "text",
                "c1": "json",
                "c2": "text"
            },
            "DATA_CREAT_DICT": {
                "c0": "text",
                "c1": "jsonb",
                "c2": "text"
            },
            "TAIL_KS": [
                "extra",
                "created_at",
                "update_at",
                "y",
                "m",
                "d",
                "h",
                "min",
                "s",
                "ms",
                "zone",
                "soffset",
                "utc_wd",
                "lcl_wd"
            ],
            "TAIL_SRCH_TYPS": [
                "json",
                "mts",
                "mts",
                "smallint",
                "smallint",
                "smallint",
                "smallint",
                "smallint",
                "smallint",
                "smallint",
                "text",
                "integer",
                "smallint",
                "smallint"
            ],
            "TAIL_TYPS": [
                "jsonb",
                "bigint",
                "bigint",
                "smallint",
                "smallint",
                "smallint",
                "smallint",
                "smallint",
                "smallint",
                "smallint",
                "text",
                "integer",
                "smallint",
                "smallint"
            ],
            "TAIL_SRCH_DICT": {
                "extra": "json",
                "created_at": "mts",
                "update_at": "mts",
                "y": "smallint",
                "m": "smallint",
                "d": "smallint",
                "h": "smallint",
                "min": "smallint",
                "s": "smallint",
                "ms": "smallint",
                "zone": "text",
                "soffset": "integer",
                "utc_wd": "smallint",
                "lcl_wd": "smallint"
            },
            "TAIL_CREAT_DICT": {
                "extra": "jsonb",
                "created_at": "bigint",
                "update_at": "bigint",
                "y": "smallint",
                "m": "smallint",
                "d": "smallint",
                "h": "smallint",
                "min": "smallint",
                "s": "smallint",
                "ms": "smallint",
                "zone": "text",
                "soffset": "integer",
                "utc_wd": "smallint",
                "lcl_wd": "smallint"
            }
        }

.....      
*/

#nv_pg_dispersed_const   -e  name text data json  alias text

/*
.....
        module.exports = {
            ......
            "DATA_ALIAS_KS": [
                "name",
                "text",
                "data"
            ],
            "DATA_NAME2RNAME": {
                "name": "c0",
                "text": "c1",
                "data": "c2"
            },
            "DATA_RNAME2NAME": {
                "c0": "name",
                "c1": "text",
                "c2": "data"
            },
            "DATA_KS": [
                "c0",
                "c1",
                "c2"
            ],
            "DATA_SRCH_TYPS": [
                "text",
                "json",
                "text"
            ],
            "DATA_TYPS":.... 
            "DATA_SRCH_DICT": .... 
            "DATA_CREAT_DICT":.... 
            "TAIL_KS":.... 
            "TAIL_SRCH_TYPS":.... 
            "TAIL_TYPS":.... 
            "TAIL_SRCH_DICT": .... 
            "TAIL_CREAT_DICT": ....
        }
        ;
.....
*/

#init and fill database

        Usage: nv_pg_dispersed_creat [options] 
        Options:
            -s, --server            db host ip default 127.0.0.1
            -n, --name              db name
            -t, --table_name        table name
            -m, --max_size          max_size of forest, default 1000000
            -T, --type_ary          if without external specified, auto generate colnames: c0,c1....., t is array of types
            -e, --external          external k t k t....
            -z, --zone              tmzone,default +0800
            -h, --help              usage


        #nv_pg_dispersed_creat -n jsonpg -t question -m 2000000 -e name text data json  alias text


        jsonpg=# select count(*) from question WHERE id!=0;
          count  
        ---------
         2000000
        (1 row)


        jsonpg=# select * from question WHERE id!=0 LIMIT 20;
         id | ___alloced___ | c0 | c1 | c2 | extra |  created_at   |   update_at   |  y   | m | d  | h | min | s  | ms | zone | soffset | utc_wd | lcl_wd 
        ----+---------------+----+----+----+-------+---------------+---------------+------+---+----+---+-----+----+----+------+---------+--------+--------
          1 | f             |    |    |    | {}    | 1659197861097 | 1659197861097 | 2022 | 7 | 31 | 0 |  17 | 41 | 97 |+0800 |   28800 |      7 |      7
          2 | f             |    |    |    | {}    | 1659197861097 | 1659197861097 | 2022 | 7 | 31 | 0 |  17 | 41 | 97 |+0800 |   28800 |      7 |      7
          3 | f             |    |    |    | {}    | 1659197861097 | 1659197861097 | 2022 | 7 | 31 | 0 |  17 | 41 | 97 |+0800 |   28800 |      7 |      7
          4 | f             |    |    |    | {}    | 1659197861097 | 1659197861097 | 2022 | 7 | 31 | 0 |  17 | 41 | 97 |+0800 |   28800 |      7 |      7
          5 | f             |    |    |    | {}    | 1659197861097 | 1659197861097 | 2022 | 7 | 31 | 0 |  17 | 41 | 97 |+0800 |   28800 |      7 |      7
          6 | f             |    |    |    | {}    | 1659197861097 | 1659197861097 | 2022 | 7 | 31 | 0 |  17 | 41 | 97 |+0800 |   28800 |      7 |      7
          7 | f             |    |    |    | {}    | 1659197861097 | 1659197861097 | 2022 | 7 | 31 | 0 |  17 | 41 | 97 |+0800 |   28800 |      7 |      7
          8 | f             |    |    |    | {}    | 1659197861097 | 1659197861097 | 2022 | 7 | 31 | 0 |  17 | 41 | 97 |+0800 |   28800 |      7 |      7
          9 | f             |    |    |    | {}    | 1659197861097 | 1659197861097 | 2022 | 7 | 31 | 0 |  17 | 41 | 97 |+0800 |   28800 |      7 |      7
         10 | f             |    |    |    | {}    | 1659197861097 | 1659197861097 | 2022 | 7 | 31 | 0 |  17 | 41 | 97 |+0800 |   28800 |      7 |      7
         11 | f             |    |    |    | {}    | 1659197861097 | 1659197861097 | 2022 | 7 | 31 | 0 |  17 | 41 | 97 |+0800 |   28800 |      7 |      7
         12 | f             |    |    |    | {}    | 1659197861097 | 1659197861097 | 2022 | 7 | 31 | 0 |  17 | 41 | 97 |+0800 |   28800 |      7 |      7
         13 | f             |    |    |    | {}    | 1659197861097 | 1659197861097 | 2022 | 7 | 31 | 0 |  17 | 41 | 97 |+0800 |   28800 |      7 |      7
         14 | f             |    |    |    | {}    | 1659197861097 | 1659197861097 | 2022 | 7 | 31 | 0 |  17 | 41 | 97 |+0800 |   28800 |      7 |      7
         15 | f             |    |    |    | {}    | 1659197861097 | 1659197861097 | 2022 | 7 | 31 | 0 |  17 | 41 | 97 |+0800 |   28800 |      7 |      7
         16 | f             |    |    |    | {}    | 1659197861097 | 1659197861097 | 2022 | 7 | 31 | 0 |  17 | 41 | 97 |+0800 |   28800 |      7 |      7
         17 | f             |    |    |    | {}    | 1659197861097 | 1659197861097 | 2022 | 7 | 31 | 0 |  17 | 41 | 97 |+0800 |   28800 |      7 |      7
         18 | f             |    |    |    | {}    | 1659197861097 | 1659197861097 | 2022 | 7 | 31 | 0 |  17 | 41 | 97 |+0800 |   28800 |      7 |      7
         19 | f             |    |    |    | {}    | 1659197861097 | 1659197861097 | 2022 | 7 | 31 | 0 |  17 | 41 | 97 |+0800 |   28800 |      7 |      7
         20 | f             |    |    |    | {}    | 1659197861097 | 1659197861097 | 2022 | 7 | 31 | 0 |  17 | 41 | 97 |+0800 |   28800 |      7 |      7
        (20 rows)


            jsonpg=# SELECT id FROM question WHERE (id IN (SELECT id FROM question WHERE ___alloced___=FALSE LIMIT 1))  AND id!=0 ;
             id 
            ----
              1
            (1 row)

            jsonpg=# SELECT id FROM question WHERE (id IN (SELECT id FROM question WHERE ___alloced___=FALSE LIMIT 5)) AND id!=0 ORDER BY id DESC;
             id 
            ----
              5
              4
              3
              2
              1
            (5 rows)

            jsonpg=# 


            jsonpg=# SELECT * FROM question WHERE (id%2=1 AND id!=0)   ORDER BY random()  LIMIT 5;
               id    | ___alloced___ | c0 | c1 | c2 | extra |  created_at   |   update_at   |  y   | m | d  | h | min | s  | ms | zone | soffset | utc_wd | lcl_wd
            ---------+---------------+----+----+----+-------+---------------+---------------+------+---+----+---+-----+----+----+------+---------+--------+--------
               72919 | f             |    |    |    | {}    | 1659197861097 | 1659197861097 | 2022 | 7 | 31 | 0 |  17 | 41 | 97 |+0800 |   28800 |      7 |      7
              996221 | f             |    |    |    | {}    | 1659197861097 | 1659197861097 | 2022 | 7 | 31 | 0 |  17 | 41 | 97 |+0800 |   28800 |      7 |      7
              432789 | f             |    |    |    | {}    | 1659197861097 | 1659197861097 | 2022 | 7 | 31 | 0 |  17 | 41 | 97 |+0800 |   28800 |      7 |      7
             1859695 | f             |    |    |    | {}    | 1659197861097 | 1659197861097 | 2022 | 7 | 31 | 0 |  17 | 41 | 97 |+0800 |   28800 |      7 |      7
              255103 | f             |    |    |    | {}    | 1659197861097 | 1659197861097 | 2022 | 7 | 31 | 0 |  17 | 41 | 97 |+0800 |   28800 |      7 |      7
            (5 rows)

            jsonpg=#


        jsonpg=# select extra from question WHERE id=0;                                                                                                                                                                                    
                                                                                                                                extra                                                              
                                                                                                                                                                                                   
                                                                                                                                                                                                   
         {"DATA_KS": ["c0", "c1", "c2"], "TAIL_KS": ["extra", "created_at", "update_at", "y", "m", "d", "h", "min", "s", "ms", "zone", "soffset", "utc_wd", "lcl_wd"], "PRIM_KEY": "id", "PRIM_TYP"
        : "integer", "DATA_TYPS": ["text", "jsonb", "text"], "TAIL_TYPS": ["jsonb", "bigint", "bigint", "smallint", "smallint", "smallint", "smallint", "smallint", "smallint", "smallint", "text",
         "integer", "smallint", "smallint"], "INTERNAL_KS": ["___alloced___"], "DATA_ALIAS_KS": ["name", "data", "alias"], "INTERNAL_TYPS": ["bool"], "PRIM_SRCH_TYP": "integer", "DATA_SRCH_DICT":
         {"c0": "text", "c1": "json", "c2": "text"}, "DATA_SRCH_TYPS": ["text", "json", "text"], "TAIL_SRCH_DICT": {"d": "smallint", "h": "smallint", "m": "smallint", "s": "smallint", "y": "small
        int", "ms": "smallint", "min": "smallint", "zone": "text", "extra": "json", "lcl_wd": "smallint", "utc_wd": "smallint", "soffset": "integer", "update_at": "mts", "created_at": "mts"}, "TA
        IL_SRCH_TYPS": ["json", "mts", "mts", "smallint", "smallint", "smallint", "smallint", "smallint", "smallint", "smallint", "text", "integer", "smallint", "smallint"], "DATA_CREAT_DICT": {"
        c0": "text", "c1": "jsonb", "c2": "text"}, "DATA_NAME2RNAME": {"data": "c1", "name": "c0", "alias": "c2"}, "DATA_RNAME2NAME": {"c0": "name", "c1": "data", "c2": "alias"}, "TAIL_CREAT_DICT
        ": {"d": "smallint", "h": "smallint", "m": "smallint", "s": "smallint", "y": "smallint", "ms": "smallint", "min": "smallint", "zone": "text", "extra": "jsonb", "lcl_wd": "smallint", "utc_
        wd": "smallint", "soffset": "integer", "update_at": "bigint", "created_at": "bigint"}, "ENBALE_PRIM_SRCH": false, "INTERNAL_SRCH_DICT": {"___alloced___": "bool"}, "INTERNAL_SRCH_TYPS": ["
        bool"], "INTERNAL_CREAT_DICT": {"___alloced___": "bool"}}


            jsonpg=# SELECT c0,c1,c2 FROM question WHERE (min%17=0 AND id!=0) LIMIT 2;
             c0 | c1 | c2 
            ----+----+----
                |    | 
                |    | 
            (2 rows)

LICENSE

  • ISC
1.0.59

2 years ago

1.0.58

2 years ago

1.0.57

2 years ago

1.0.56

2 years ago

1.0.55

2 years ago

1.0.54

2 years ago

1.0.53

2 years ago

1.0.52

2 years ago

1.0.51

2 years ago

1.0.50

2 years ago

1.0.48

2 years ago

1.0.47

2 years ago

1.0.45

2 years ago

1.0.44

2 years ago

1.0.42

2 years ago

1.0.40

2 years ago

1.0.39

2 years ago

1.0.37

2 years ago

1.0.36

2 years ago

1.0.32

2 years ago

1.0.31

2 years ago

1.0.30

2 years ago

1.0.29

2 years ago

1.0.28

2 years ago

1.0.27

2 years ago

1.0.26

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.21

2 years ago