mirror of https://github.com/tidwall/tile38.git
Updated packages
This commit is contained in:
parent
f44bae43ca
commit
c313a63603
16
go.mod
16
go.mod
|
@ -13,27 +13,25 @@ require (
|
||||||
github.com/mmcloughlin/geohash v0.10.0
|
github.com/mmcloughlin/geohash v0.10.0
|
||||||
github.com/nats-io/gnatsd v1.4.1 // indirect
|
github.com/nats-io/gnatsd v1.4.1 // indirect
|
||||||
github.com/nats-io/go-nats v1.6.0
|
github.com/nats-io/go-nats v1.6.0
|
||||||
github.com/nats-io/nuid v1.0.0 // indirect
|
github.com/nats-io/nuid v1.0.1 // indirect
|
||||||
github.com/peterh/liner v1.2.0
|
github.com/peterh/liner v1.2.0
|
||||||
github.com/streadway/amqp v1.0.0
|
github.com/streadway/amqp v1.0.0
|
||||||
github.com/stretchr/testify v1.5.1 // indirect
|
github.com/stretchr/testify v1.5.1 // indirect
|
||||||
github.com/tidwall/btree v0.2.2
|
github.com/tidwall/btree v0.3.0
|
||||||
github.com/tidwall/buntdb v1.1.4
|
github.com/tidwall/buntdb v1.1.8
|
||||||
github.com/tidwall/cities v0.0.0-20190730194520-dbe1ae0b862c // indirect
|
github.com/tidwall/cities v0.0.0-20190730194520-dbe1ae0b862c // indirect
|
||||||
github.com/tidwall/geoindex v1.1.0
|
github.com/tidwall/geoindex v1.1.0
|
||||||
github.com/tidwall/geojson v1.2.3
|
github.com/tidwall/geojson v1.2.3
|
||||||
github.com/tidwall/gjson v1.6.1
|
github.com/tidwall/gjson v1.6.7
|
||||||
github.com/tidwall/lotsa v1.0.2 // indirect
|
github.com/tidwall/lotsa v1.0.2 // indirect
|
||||||
github.com/tidwall/match v1.0.1
|
github.com/tidwall/match v1.0.3
|
||||||
github.com/tidwall/pretty v1.0.2
|
github.com/tidwall/pretty v1.0.2
|
||||||
github.com/tidwall/rbang v1.2.2
|
github.com/tidwall/rbang v1.2.2
|
||||||
github.com/tidwall/redbench v0.0.0-20181110173744-17c5b5b864a4
|
github.com/tidwall/redbench v0.1.0
|
||||||
github.com/tidwall/redcon v1.3.2
|
github.com/tidwall/redcon v1.3.2
|
||||||
github.com/tidwall/resp v0.0.0-20160908231031-b2b1a7ca20e3
|
github.com/tidwall/resp v0.1.0
|
||||||
github.com/tidwall/rhh v1.1.0
|
github.com/tidwall/rhh v1.1.0
|
||||||
github.com/tidwall/sjson v1.1.1
|
github.com/tidwall/sjson v1.1.1
|
||||||
github.com/tidwall/tinybtree v1.0.1
|
|
||||||
github.com/tidwall/tinyqueue v0.0.0-20180302190814-1e39f5511563 // indirect
|
|
||||||
github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da
|
github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da
|
||||||
golang.org/x/crypto v0.0.0-20200204104054-c9f3fb736b72
|
golang.org/x/crypto v0.0.0-20200204104054-c9f3fb736b72
|
||||||
golang.org/x/net v0.0.0-20200301022130-244492dfa37a
|
golang.org/x/net v0.0.0-20200301022130-244492dfa37a
|
||||||
|
|
44
go.sum
44
go.sum
|
@ -145,8 +145,8 @@ github.com/nats-io/gnatsd v1.4.1 h1:RconcfDeWpKCD6QIIwiVFcvForlXpWeJP7i5/lDLy44=
|
||||||
github.com/nats-io/gnatsd v1.4.1/go.mod h1:nqco77VO78hLCJpIcVfygDP2rPGfsEHkGTUk94uh5DQ=
|
github.com/nats-io/gnatsd v1.4.1/go.mod h1:nqco77VO78hLCJpIcVfygDP2rPGfsEHkGTUk94uh5DQ=
|
||||||
github.com/nats-io/go-nats v1.6.0 h1:FznPwMfrVwGnSCh7JTXyJDRW0TIkD4Tr+M1LPJt9T70=
|
github.com/nats-io/go-nats v1.6.0 h1:FznPwMfrVwGnSCh7JTXyJDRW0TIkD4Tr+M1LPJt9T70=
|
||||||
github.com/nats-io/go-nats v1.6.0/go.mod h1:+t7RHT5ApZebkrQdnn6AhQJmhJJiKAvJUio1PiiCtj0=
|
github.com/nats-io/go-nats v1.6.0/go.mod h1:+t7RHT5ApZebkrQdnn6AhQJmhJJiKAvJUio1PiiCtj0=
|
||||||
github.com/nats-io/nuid v1.0.0 h1:44QGdhbiANq8ZCbUkdn6W5bqtg+mHuDE4wOUuxxndFs=
|
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
|
||||||
github.com/nats-io/nuid v1.0.0/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
|
github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
|
||||||
github.com/peterh/liner v1.2.0 h1:w/UPXyl5GfahFxcTOz2j9wCIHNI+pUPr2laqpojKNCg=
|
github.com/peterh/liner v1.2.0 h1:w/UPXyl5GfahFxcTOz2j9wCIHNI+pUPr2laqpojKNCg=
|
||||||
github.com/peterh/liner v1.2.0/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0=
|
github.com/peterh/liner v1.2.0/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0=
|
||||||
github.com/pierrec/lz4 v2.4.1+incompatible h1:mFe7ttWaflA46Mhqh+jUfjp2qTbPYxLB2/OyBppH9dg=
|
github.com/pierrec/lz4 v2.4.1+incompatible h1:mFe7ttWaflA46Mhqh+jUfjp2qTbPYxLB2/OyBppH9dg=
|
||||||
|
@ -166,10 +166,10 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||||
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
|
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
|
||||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||||
github.com/tidwall/btree v0.2.2 h1:VVo0JW/tdidNdQzNsDR4wMbL3heaxA1DGleyzQ3/niY=
|
github.com/tidwall/btree v0.3.0 h1:LcwmLI5kv+AaH/xnBgOuKfbu5eLBWVdWTpD2o+qSRdU=
|
||||||
github.com/tidwall/btree v0.2.2/go.mod h1:huei1BkDWJ3/sLXmO+bsCNELL+Bp2Kks9OLyQFkzvA8=
|
github.com/tidwall/btree v0.3.0/go.mod h1:huei1BkDWJ3/sLXmO+bsCNELL+Bp2Kks9OLyQFkzvA8=
|
||||||
github.com/tidwall/buntdb v1.1.4 h1:W7y9+2dM3GOswU0t3pz6+BcwZXjj/tVOhPcO6EHufME=
|
github.com/tidwall/buntdb v1.1.8 h1:3rHHTlR4uFACKLbC+ws9jH0Ytk1Pd+n/cMEERtbMVKk=
|
||||||
github.com/tidwall/buntdb v1.1.4/go.mod h1:06+/n7EFf6uUaIG5r9xZcExYN3H0Lnc+g/Kqx0fZFkI=
|
github.com/tidwall/buntdb v1.1.8/go.mod h1:a/Xp8Hsllzxex0WTNdANz2+hOwGaYDHW4xBK9dMp30w=
|
||||||
github.com/tidwall/cities v0.0.0-20190730194520-dbe1ae0b862c h1:K/6v4woP8qym96ZKorm6mbOhEs3xhlJoEQWiJ5WT7mw=
|
github.com/tidwall/cities v0.0.0-20190730194520-dbe1ae0b862c h1:K/6v4woP8qym96ZKorm6mbOhEs3xhlJoEQWiJ5WT7mw=
|
||||||
github.com/tidwall/cities v0.0.0-20190730194520-dbe1ae0b862c/go.mod h1:lV/HDp2gCcRcHJWqgt6Di54GiDrTZwh1aG2ZUPNbqa4=
|
github.com/tidwall/cities v0.0.0-20190730194520-dbe1ae0b862c/go.mod h1:lV/HDp2gCcRcHJWqgt6Di54GiDrTZwh1aG2ZUPNbqa4=
|
||||||
github.com/tidwall/geoindex v1.1.0 h1:d/pGCgKUonfQINd1235kKqx9gWBU4N7GjDS9WvbPvLY=
|
github.com/tidwall/geoindex v1.1.0 h1:d/pGCgKUonfQINd1235kKqx9gWBU4N7GjDS9WvbPvLY=
|
||||||
|
@ -177,39 +177,35 @@ github.com/tidwall/geoindex v1.1.0/go.mod h1:3gTa91BW+eiVIipuR6aU1Y9Sa0q75b1teE/
|
||||||
github.com/tidwall/geojson v1.2.3 h1:z//3h73oC+EkQ1TQr0oLbk7fKtGqAYkhSILtFZi1j8w=
|
github.com/tidwall/geojson v1.2.3 h1:z//3h73oC+EkQ1TQr0oLbk7fKtGqAYkhSILtFZi1j8w=
|
||||||
github.com/tidwall/geojson v1.2.3/go.mod h1:tBjfxeALRFLc25LLpjtWzy2nIrNmW1ze1EAhLtd8+QQ=
|
github.com/tidwall/geojson v1.2.3/go.mod h1:tBjfxeALRFLc25LLpjtWzy2nIrNmW1ze1EAhLtd8+QQ=
|
||||||
github.com/tidwall/gjson v1.6.0/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls=
|
github.com/tidwall/gjson v1.6.0/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls=
|
||||||
github.com/tidwall/gjson v1.6.1 h1:LRbvNuNuvAiISWg6gxLEFuCe72UKy5hDqhxW/8183ws=
|
github.com/tidwall/gjson v1.6.7 h1:Mb1M9HZCRWEcXQ8ieJo7auYyyiSux6w9XN3AdTpxJrE=
|
||||||
github.com/tidwall/gjson v1.6.1/go.mod h1:BaHyNc5bjzYkPqgLq7mdVzeiRtULKULXLgZFKsxEHI0=
|
github.com/tidwall/gjson v1.6.7/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI=
|
||||||
github.com/tidwall/grect v0.0.0-20161006141115-ba9a043346eb h1:5NSYaAdrnblKByzd7XByQEJVT8+9v0W/tIY0Oo4OwrE=
|
github.com/tidwall/grect v0.1.0 h1:ICcKWD5uu5A5fmxApGIa0QRvfGnSWKRd07POT08CQSA=
|
||||||
github.com/tidwall/grect v0.0.0-20161006141115-ba9a043346eb/go.mod h1:lKYYLFIr9OIgdgrtgkZ9zgRxRdvPYsExnYBsEAd8W5M=
|
github.com/tidwall/grect v0.1.0/go.mod h1:sa5O42oP6jWfTShL9ka6Sgmg3TgIK649veZe05B7+J8=
|
||||||
github.com/tidwall/lotsa v1.0.2 h1:dNVBH5MErdaQ/xd9s769R31/n2dXavsQ0Yf4TMEHHw8=
|
github.com/tidwall/lotsa v1.0.2 h1:dNVBH5MErdaQ/xd9s769R31/n2dXavsQ0Yf4TMEHHw8=
|
||||||
github.com/tidwall/lotsa v1.0.2/go.mod h1:X6NiU+4yHA3fE3Puvpnn1XMDrFZrE9JO2/w+UMuqgR8=
|
github.com/tidwall/lotsa v1.0.2/go.mod h1:X6NiU+4yHA3fE3Puvpnn1XMDrFZrE9JO2/w+UMuqgR8=
|
||||||
github.com/tidwall/match v1.0.1 h1:PnKP62LPNxHKTwvHHZZzdOAOCtsJTjo6dZLCwpKm5xc=
|
|
||||||
github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E=
|
github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E=
|
||||||
|
github.com/tidwall/match v1.0.3 h1:FQUVvBImDutD8wJLN6c5eMzWtjgONK9MwIBCOrUJKeE=
|
||||||
|
github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
||||||
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
||||||
github.com/tidwall/pretty v1.0.1/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
github.com/tidwall/pretty v1.0.1/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
||||||
github.com/tidwall/pretty v1.0.2 h1:Z7S3cePv9Jwm1KwS0513MRaoUe3S01WPbLNV40pwWZU=
|
github.com/tidwall/pretty v1.0.2 h1:Z7S3cePv9Jwm1KwS0513MRaoUe3S01WPbLNV40pwWZU=
|
||||||
github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
||||||
github.com/tidwall/rbang v1.2.2 h1:j5JZDSsybpGzCabqFpabaQNU5MCmIrlThXVUF7LD99I=
|
github.com/tidwall/rbang v1.2.2 h1:j5JZDSsybpGzCabqFpabaQNU5MCmIrlThXVUF7LD99I=
|
||||||
github.com/tidwall/rbang v1.2.2/go.mod h1:aMGOM1Wj50tooEO/0aO9j+7gyHUs3bUW0t4Q+xiuOjg=
|
github.com/tidwall/rbang v1.2.2/go.mod h1:aMGOM1Wj50tooEO/0aO9j+7gyHUs3bUW0t4Q+xiuOjg=
|
||||||
github.com/tidwall/redbench v0.0.0-20181110173744-17c5b5b864a4 h1:W7pJCltjA/nrESHhV47Y01p2gFdInOY9qkq69uEzN0o=
|
github.com/tidwall/redbench v0.1.0 h1:UZYUMhwMMObQRq5xU4SA3lmlJRztXzqtushDii+AmPo=
|
||||||
github.com/tidwall/redbench v0.0.0-20181110173744-17c5b5b864a4/go.mod h1:zxcRGCq/JcqV48YjK9WxBNJL7JSpMzbLXaHvMcnanKQ=
|
github.com/tidwall/redbench v0.1.0/go.mod h1:zxcRGCq/JcqV48YjK9WxBNJL7JSpMzbLXaHvMcnanKQ=
|
||||||
github.com/tidwall/redcon v1.3.2 h1:8INx/Nm3VSUbDUT16TH1rMgYQsbXNqy9xcX70edHXbo=
|
github.com/tidwall/redcon v1.3.2 h1:8INx/Nm3VSUbDUT16TH1rMgYQsbXNqy9xcX70edHXbo=
|
||||||
github.com/tidwall/redcon v1.3.2/go.mod h1:bdYBm4rlcWpst2XMwKVzWDF9CoUxEbUmM7CQrKeOZas=
|
github.com/tidwall/redcon v1.3.2/go.mod h1:bdYBm4rlcWpst2XMwKVzWDF9CoUxEbUmM7CQrKeOZas=
|
||||||
github.com/tidwall/resp v0.0.0-20160908231031-b2b1a7ca20e3 h1:+weN0RLHfv5fugOSyHPxbY9feCqi6JnLBFsq8Jvx7/E=
|
github.com/tidwall/resp v0.1.0 h1:zZ6Hq+2cY4QqhZ4LqrV05T5yLOSPspj+l+DgAoJ25Ak=
|
||||||
github.com/tidwall/resp v0.0.0-20160908231031-b2b1a7ca20e3/go.mod h1:18xEj855iMY2bK6tNF2A4x+nZy5gWO1iO7OOl3jETKw=
|
github.com/tidwall/resp v0.1.0/go.mod h1:18xEj855iMY2bK6tNF2A4x+nZy5gWO1iO7OOl3jETKw=
|
||||||
github.com/tidwall/rhh v1.1.0 h1:U+3RGzEB6VoBBkLlsAaF3ThjwZ0JGibplJhDin5Ub/Y=
|
github.com/tidwall/rhh v1.1.0 h1:U+3RGzEB6VoBBkLlsAaF3ThjwZ0JGibplJhDin5Ub/Y=
|
||||||
github.com/tidwall/rhh v1.1.0/go.mod h1:37/ybjMQQ4nDztczc//g/WBd2X51vogKHWL3xC8kY24=
|
github.com/tidwall/rhh v1.1.0/go.mod h1:37/ybjMQQ4nDztczc//g/WBd2X51vogKHWL3xC8kY24=
|
||||||
github.com/tidwall/rtree v0.0.0-20201027154624-32188eeb08a8 h1:BsKSRhu0TDB6Snq8SutN9KQHc6vqHEXJTcAFwyGNius=
|
github.com/tidwall/rtree v0.1.0 h1:w/RoiV3WvrKF/EzLaK6CT0MXAV6KveGy3EOyeJACoFA=
|
||||||
github.com/tidwall/rtree v0.0.0-20201027154624-32188eeb08a8/go.mod h1:/h+UnNGt0IhNNJLkGikcdcJqm66zGD/uJGMRxK/9+Ao=
|
github.com/tidwall/rtree v0.1.0/go.mod h1:xsujlpupsrYVnWaok1pqGtxhj9TKHSbMbY8eKPatQ4U=
|
||||||
github.com/tidwall/sjson v1.1.1 h1:7h1vk049Jnd5EH9NyzNiEuwYW4b5qgreBbqRC19AS3U=
|
github.com/tidwall/sjson v1.1.1 h1:7h1vk049Jnd5EH9NyzNiEuwYW4b5qgreBbqRC19AS3U=
|
||||||
github.com/tidwall/sjson v1.1.1/go.mod h1:yvVuSnpEQv5cYIrO+AT6kw4QVfd5SDZoGIS7/5+fZFs=
|
github.com/tidwall/sjson v1.1.1/go.mod h1:yvVuSnpEQv5cYIrO+AT6kw4QVfd5SDZoGIS7/5+fZFs=
|
||||||
<<<<<<< HEAD
|
github.com/tidwall/tinyqueue v0.1.1 h1:SpNEvEggbpyN5DIReaJ2/1ndroY8iyEGxPYxoSaymYE=
|
||||||
github.com/tidwall/tinybtree v1.0.1 h1:g1kLLw/dCJgtH14AFqUoob0MtSfThw4xQILCGMQd8J8=
|
github.com/tidwall/tinyqueue v0.1.1/go.mod h1:O/QNHwrnjqr6IHItYrzoHAKYhBkLI67Q096fQP5zMYw=
|
||||||
github.com/tidwall/tinybtree v1.0.1/go.mod h1:0aFQG6KLQz3j57CeVgXlmKO3RSQ3myhJn2H+r84IgSY=
|
|
||||||
=======
|
|
||||||
>>>>>>> 016f3971 (Replace tinybtree)
|
|
||||||
github.com/tidwall/tinyqueue v0.0.0-20180302190814-1e39f5511563 h1:Otn9S136ELckZ3KKDyCkxapfufrqDqwmGjcHfAyXRrE=
|
|
||||||
github.com/tidwall/tinyqueue v0.0.0-20180302190814-1e39f5511563/go.mod h1:mLqSmt7Dv/CNneF2wfcChfN1rvapyQr01LGKnKex0DQ=
|
|
||||||
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I=
|
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I=
|
||||||
github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y=
|
github.com/xdg/stringprep v1.0.0/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y=
|
||||||
github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da h1:NimzV1aGyq29m5ukMK0AMWEhFaL/lrEOaephfuoiARg=
|
github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da h1:NimzV1aGyq29m5ukMK0AMWEhFaL/lrEOaephfuoiARg=
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
language: go
|
language: go
|
||||||
sudo: false
|
sudo: false
|
||||||
go:
|
go:
|
||||||
- 1.5
|
- 1.9.x
|
||||||
|
- 1.10.x
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- go get -t ./...
|
- go get -t ./...
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
# NATS NUID Governance
|
||||||
|
|
||||||
|
NATS NUID is part of the NATS project and is subject to the [NATS Governance](https://github.com/nats-io/nats-general/blob/master/GOVERNANCE.md).
|
|
@ -1,21 +1,201 @@
|
||||||
The MIT License (MIT)
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
Copyright (c) 2012-2016 Apcera Inc.
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
1. Definitions.
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
copies or substantial portions of the Software.
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
the copyright owner that is granting the License.
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
other entities that control, are controlled by, or are under common
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
control with that entity. For the purposes of this definition,
|
||||||
SOFTWARE.
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright [yyyy] [name of copyright owner]
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
# Maintainers
|
||||||
|
|
||||||
|
Maintainership is on a per project basis.
|
||||||
|
|
||||||
|
### Core-maintainers
|
||||||
|
- Derek Collison <derek@nats.io> [@derekcollison](https://github.com/derekcollison)
|
|
@ -1,9 +1,9 @@
|
||||||
# NUID
|
# NUID
|
||||||
|
|
||||||
[![License MIT](https://img.shields.io/npm/l/express.svg)](http://opensource.org/licenses/MIT)
|
[![License Apache 2](https://img.shields.io/badge/License-Apache2-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
|
||||||
[![ReportCard](http://goreportcard.com/badge/nats-io/nuid)](http://goreportcard.com/report/nats-io/nuid)
|
[![ReportCard](http://goreportcard.com/badge/nats-io/nuid)](http://goreportcard.com/report/nats-io/nuid)
|
||||||
[![Build Status](https://travis-ci.org/nats-io/nuid.svg?branch=master)](http://travis-ci.org/nats-io/nuid)
|
[![Build Status](https://travis-ci.org/nats-io/nuid.svg?branch=master)](http://travis-ci.org/nats-io/nuid)
|
||||||
[![Release](https://img.shields.io/badge/release-v1.0.0-1eb0fc.svg)](https://github.com/nats-io/nuid/releases/tag/v1.0.0)
|
[![Release](https://img.shields.io/badge/release-v1.0.1-1eb0fc.svg)](https://github.com/nats-io/nuid/releases/tag/v1.0.1)
|
||||||
[![GoDoc](http://godoc.org/github.com/nats-io/nuid?status.png)](http://godoc.org/github.com/nats-io/nuid)
|
[![GoDoc](http://godoc.org/github.com/nats-io/nuid?status.png)](http://godoc.org/github.com/nats-io/nuid)
|
||||||
[![Coverage Status](https://coveralls.io/repos/github/nats-io/nuid/badge.svg?branch=master)](https://coveralls.io/github/nats-io/nuid?branch=master)
|
[![Coverage Status](https://coveralls.io/repos/github/nats-io/nuid/badge.svg?branch=master)](https://coveralls.io/github/nats-io/nuid?branch=master)
|
||||||
|
|
||||||
|
@ -35,32 +35,13 @@ NUID needs to be very fast to generate and be truly unique, all while being entr
|
||||||
NUID uses 12 bytes of crypto generated data (entropy draining), and 10 bytes of pseudo-random
|
NUID uses 12 bytes of crypto generated data (entropy draining), and 10 bytes of pseudo-random
|
||||||
sequential data that increments with a pseudo-random increment.
|
sequential data that increments with a pseudo-random increment.
|
||||||
|
|
||||||
Total length of a NUID string is 22 bytes of base 36 ascii text, so 36^22 or
|
Total length of a NUID string is 22 bytes of base 62 ascii text, so 62^22 or
|
||||||
17324272922341479351919144385642496 possibilities.
|
2707803647802660400290261537185326956544 possibilities.
|
||||||
|
|
||||||
NUID can generate identifiers as fast as 60ns, or ~16 million per second. There is an associated
|
NUID can generate identifiers as fast as 60ns, or ~16 million per second. There is an associated
|
||||||
benchmark you can use to test performance on your own hardware.
|
benchmark you can use to test performance on your own hardware.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
(The MIT License)
|
Unless otherwise noted, the NATS source files are distributed
|
||||||
|
under the Apache Version 2.0 license found in the LICENSE file.
|
||||||
Copyright (c) 2016 Apcera Inc.
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to
|
|
||||||
deal in the Software without restriction, including without limitation the
|
|
||||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
||||||
sell copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
||||||
IN THE SOFTWARE.
|
|
||||||
|
|
|
@ -1,4 +1,15 @@
|
||||||
// Copyright 2016 Apcera Inc. All rights reserved.
|
// Copyright 2016-2019 The NATS Authors
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
// A unique identifier generator that is high performance, very fast, and tries to be entropy pool friendly.
|
// A unique identifier generator that is high performance, very fast, and tries to be entropy pool friendly.
|
||||||
package nuid
|
package nuid
|
||||||
|
@ -20,7 +31,7 @@ import (
|
||||||
// Total is 22 bytes of base 62 ascii text :)
|
// Total is 22 bytes of base 62 ascii text :)
|
||||||
|
|
||||||
// Version of the library
|
// Version of the library
|
||||||
const Version = "1.0.0"
|
const Version = "1.0.1"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
|
digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
|
||||||
|
@ -94,7 +105,7 @@ func (n *NUID) Next() string {
|
||||||
bs := b[:preLen]
|
bs := b[:preLen]
|
||||||
copy(bs, n.pre)
|
copy(bs, n.pre)
|
||||||
|
|
||||||
// copy in the seq in base36.
|
// copy in the seq in base62.
|
||||||
for i, l := len(b), seq; i > preLen; l /= base {
|
for i, l := len(b), seq; i > preLen; l /= base {
|
||||||
i -= 1
|
i -= 1
|
||||||
b[i] = digits[l%base]
|
b[i] = digits[l%base]
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
language: go
|
|
|
@ -1,5 +1,190 @@
|
||||||
# B-tree for Go
|
# btree
|
||||||
|
|
||||||
![Travis CI Build Status](https://api.travis-ci.org/tidwall/btree.svg?branch=master)
|
|
||||||
[![GoDoc](https://godoc.org/github.com/tidwall/btree?status.svg)](https://godoc.org/github.com/tidwall/btree)
|
[![GoDoc](https://godoc.org/github.com/tidwall/btree?status.svg)](https://godoc.org/github.com/tidwall/btree)
|
||||||
|
|
||||||
|
An [efficient](#performance) [B-tree](https://en.wikipedia.org/wiki/B-tree) implementation in Go.
|
||||||
|
|
||||||
|
## Installing
|
||||||
|
|
||||||
|
To start using btree, install Go and run `go get`:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ go get -u github.com/tidwall/btree
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```go
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/tidwall/btree"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Item struct {
|
||||||
|
Key, Val string
|
||||||
|
}
|
||||||
|
|
||||||
|
// byKeys is a comparison function that compares item keys and returns true
|
||||||
|
// when a is less than b.
|
||||||
|
func byKeys(a, b interface{}) bool {
|
||||||
|
i1, i2 := a.(*Item), b.(*Item)
|
||||||
|
return i1.Key < i2.Key
|
||||||
|
}
|
||||||
|
|
||||||
|
// byVals is a comparison function that compares item values and returns true
|
||||||
|
// when a is less than b.
|
||||||
|
func byVals(a, b interface{}) bool {
|
||||||
|
i1, i2 := a.(*Item), b.(*Item)
|
||||||
|
if i1.Val < i2.Val {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if i1.Val > i2.Val {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
// Both vals are equal so we should fall though
|
||||||
|
// and let the key comparison take over.
|
||||||
|
return byKeys(a, b)
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
// Create a tree for keys and a tree for values.
|
||||||
|
// The "keys" tree will be sorted on the Keys field.
|
||||||
|
// The "values" tree will be sorted on the Values field.
|
||||||
|
keys := btree.New(byKeys)
|
||||||
|
vals := btree.New(byVals)
|
||||||
|
|
||||||
|
// Create some items.
|
||||||
|
users := []*Item{
|
||||||
|
&Item{Key: "user:1", Val: "Jane"},
|
||||||
|
&Item{Key: "user:2", Val: "Andy"},
|
||||||
|
&Item{Key: "user:3", Val: "Steve"},
|
||||||
|
&Item{Key: "user:4", Val: "Andrea"},
|
||||||
|
&Item{Key: "user:5", Val: "Janet"},
|
||||||
|
&Item{Key: "user:6", Val: "Andy"},
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insert each user into both trees
|
||||||
|
for _, user := range users {
|
||||||
|
keys.Set(user)
|
||||||
|
vals.Set(user)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Iterate over each user in the key tree
|
||||||
|
keys.Ascend(nil, func(item interface{}) bool {
|
||||||
|
kvi := item.(*Item)
|
||||||
|
fmt.Printf("%s %s\n", kvi.Key, kvi.Val)
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
|
||||||
|
fmt.Printf("\n")
|
||||||
|
// Iterate over each user in the val tree
|
||||||
|
vals.Ascend(nil, func(item interface{}) bool {
|
||||||
|
kvi := item.(*Item)
|
||||||
|
fmt.Printf("%s %s\n", kvi.Key, kvi.Val)
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
|
||||||
|
// Output:
|
||||||
|
// user:1 Jane
|
||||||
|
// user:2 Andy
|
||||||
|
// user:3 Steve
|
||||||
|
// user:4 Andrea
|
||||||
|
// user:5 Janet
|
||||||
|
// user:6 Andy
|
||||||
|
//
|
||||||
|
// user:4 Andrea
|
||||||
|
// user:2 Andy
|
||||||
|
// user:6 Andy
|
||||||
|
// user:1 Jane
|
||||||
|
// user:5 Janet
|
||||||
|
// user:3 Steve
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Operations
|
||||||
|
|
||||||
|
### Basic
|
||||||
|
|
||||||
|
```
|
||||||
|
Len() # return the number of items in the btree
|
||||||
|
Set(item) # insert or replace an existing item
|
||||||
|
Get(item) # get an existing item
|
||||||
|
Delete(item) # delete an item
|
||||||
|
```
|
||||||
|
|
||||||
|
### Iteration
|
||||||
|
|
||||||
|
```
|
||||||
|
Ascend(pivot, iter) # scan items in ascending order starting at pivot.
|
||||||
|
Descend(pivot, iter) # scan items in descending order starting at pivot.
|
||||||
|
```
|
||||||
|
|
||||||
|
### Queues
|
||||||
|
|
||||||
|
```
|
||||||
|
Min() # return the first item in the btree
|
||||||
|
Max() # return the last item in the btree
|
||||||
|
PopMin() # remove and return the first item in the btree
|
||||||
|
PopMax() # remove and return the last item in the btree
|
||||||
|
```
|
||||||
|
### Bulk loading
|
||||||
|
|
||||||
|
```
|
||||||
|
Load(item) # load presorted items into tree
|
||||||
|
```
|
||||||
|
|
||||||
|
### Path hints
|
||||||
|
|
||||||
|
```
|
||||||
|
SetHint(item, *hint) # insert or replace an existing item
|
||||||
|
GetHint(item, *hint) # get an existing item
|
||||||
|
DeleteHint(item, *hint) # delete an item
|
||||||
|
```
|
||||||
|
|
||||||
|
## Performance
|
||||||
|
|
||||||
|
This implementation was designed with performance in mind.
|
||||||
|
|
||||||
|
The following benchmarks were run on my 2019 Macbook Pro (2.4 GHz 8-Core Intel Core i9) using Go 1.15.3. The items are simple 8-byte ints.
|
||||||
|
|
||||||
|
- `tidwall`: The [tidwall/btree](https://github.com/tidwall/btree) package
|
||||||
|
- `google`: The [google/btree](https://github.com/google/btree) package
|
||||||
|
- `go-arr`: Just a simple Go array
|
||||||
|
|
||||||
|
```
|
||||||
|
** sequential set **
|
||||||
|
tidwall: set-seq 1,000,000 ops in 143ms, 6,996,275/sec, 142 ns/op, 30.9 MB, 32 bytes/op
|
||||||
|
tidwall: set-seq-hint 1,000,000 ops in 65ms, 15,441,082/sec, 64 ns/op, 30.9 MB, 32 bytes/op
|
||||||
|
tidwall: load-seq 1,000,000 ops in 19ms, 53,242,398/sec, 18 ns/op, 30.9 MB, 32 bytes/op
|
||||||
|
google: set-seq 1,000,000 ops in 175ms, 5,700,922/sec, 175 ns/op, 33.1 MB, 34 bytes/op
|
||||||
|
go-arr: append 1,000,000 ops in 52ms, 19,153,714/sec, 52 ns/op, 41.3 MB, 43 bytes/op
|
||||||
|
|
||||||
|
** random set **
|
||||||
|
tidwall: set-rand 1,000,000 ops in 589ms, 1,697,471/sec, 589 ns/op, 22.5 MB, 23 bytes/op
|
||||||
|
tidwall: set-rand-hint 1,000,000 ops in 592ms, 1,688,184/sec, 592 ns/op, 22.2 MB, 23 bytes/op
|
||||||
|
tidwall: load-rand 1,000,000 ops in 578ms, 1,728,932/sec, 578 ns/op, 22.3 MB, 23 bytes/op
|
||||||
|
google: set-rand 1,000,000 ops in 662ms, 1,509,924/sec, 662 ns/op, 32.1 MB, 33 bytes/op
|
||||||
|
|
||||||
|
** sequential get **
|
||||||
|
tidwall: get-seq 1,000,000 ops in 111ms, 8,995,090/sec, 111 ns/op
|
||||||
|
tidwall: get-seq-hint 1,000,000 ops in 56ms, 18,017,397/sec, 55 ns/op
|
||||||
|
google: get-seq 1,000,000 ops in 135ms, 7,414,046/sec, 134 ns/op
|
||||||
|
|
||||||
|
** random get **
|
||||||
|
tidwall: get-rand 1,000,000 ops in 139ms, 7,214,017/sec, 138 ns/op
|
||||||
|
tidwall: get-rand-hint 1,000,000 ops in 191ms, 5,243,833/sec, 190 ns/op
|
||||||
|
google: get-rand 1,000,000 ops in 161ms, 6,199,818/sec, 161 ns/op
|
||||||
|
```
|
||||||
|
|
||||||
|
*You can find the benchmark utility at [tidwall/btree-benchmark](https://github.com/tidwall/btree-benchmark)*
|
||||||
|
|
||||||
|
## Contact
|
||||||
|
|
||||||
|
Josh Baker [@tidwall](http://twitter.com/tidwall)
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Source code is available under the MIT [License](/LICENSE).
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
|
|
||||||
package btree
|
package btree
|
||||||
|
|
||||||
|
//tinygen:T interface{}
|
||||||
|
|
||||||
const maxItems = 255
|
const maxItems = 255
|
||||||
const minItems = maxItems * 40 / 100
|
const minItems = maxItems * 40 / 100
|
||||||
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
language: go
|
|
||||||
|
|
||||||
go:
|
|
||||||
- 1.15.x
|
|
|
@ -3,10 +3,9 @@
|
||||||
src="logo.png"
|
src="logo.png"
|
||||||
width="307" height="150" border="0" alt="BuntDB">
|
width="307" height="150" border="0" alt="BuntDB">
|
||||||
<br>
|
<br>
|
||||||
<a href="https://travis-ci.org/tidwall/buntdb"><img src="https://img.shields.io/travis/tidwall/buntdb.svg?style=flat-square" alt="Build Status"></a>
|
|
||||||
<a href="http://gocover.io/github.com/tidwall/buntdb"><img src="https://img.shields.io/badge/coverage-95%25-brightgreen.svg?style=flat-square" alt="Code Coverage"></a>
|
|
||||||
<a href="https://goreportcard.com/report/github.com/tidwall/buntdb"><img src="https://goreportcard.com/badge/github.com/tidwall/buntdb?style=flat-square" alt="Go Report Card"></a>
|
<a href="https://goreportcard.com/report/github.com/tidwall/buntdb"><img src="https://goreportcard.com/badge/github.com/tidwall/buntdb?style=flat-square" alt="Go Report Card"></a>
|
||||||
<a href="https://godoc.org/github.com/tidwall/buntdb"><img src="https://img.shields.io/badge/api-reference-blue.svg?style=flat-square" alt="GoDoc"></a>
|
<a href="https://godoc.org/github.com/tidwall/buntdb"><img src="https://img.shields.io/badge/go-documentation-blue.svg?style=flat-square" alt="Godoc"></a>
|
||||||
|
<a href="https://github.com/tidwall/buntdb/blob/master/LICENSE"><img src="https://img.shields.io/github/license/tidwall/buntdb.svg?style=flat-square" alt="LICENSE"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
BuntDB is a low-level, in-memory, key/value store in pure Go.
|
BuntDB is a low-level, in-memory, key/value store in pure Go.
|
||||||
|
|
|
@ -861,7 +861,7 @@ func (db *DB) readLoad(rd io.Reader, modTime time.Time) error {
|
||||||
if strings.ToLower(parts[3]) != "ex" {
|
if strings.ToLower(parts[3]) != "ex" {
|
||||||
return ErrInvalid
|
return ErrInvalid
|
||||||
}
|
}
|
||||||
ex, err := strconv.ParseInt(parts[4], 10, 64)
|
ex, err := strconv.ParseUint(parts[4], 10, 64)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -1390,7 +1390,9 @@ func (tx *Tx) Set(key, value string, opts *SetOptions) (previousValue string,
|
||||||
// create a rollback entry with a nil value. A nil value indicates
|
// create a rollback entry with a nil value. A nil value indicates
|
||||||
// that the entry should be deleted on rollback. When the value is
|
// that the entry should be deleted on rollback. When the value is
|
||||||
// *not* nil, that means the entry should be reverted.
|
// *not* nil, that means the entry should be reverted.
|
||||||
|
if _, ok := tx.wc.rollbackItems[key]; !ok {
|
||||||
tx.wc.rollbackItems[key] = nil
|
tx.wc.rollbackItems[key] = nil
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// A previous item already exists in the database. Let's create a
|
// A previous item already exists in the database. Let's create a
|
||||||
// rollback entry with the item as the value. We need to check the
|
// rollback entry with the item as the value. We need to check the
|
||||||
|
|
|
@ -3,10 +3,9 @@ module github.com/tidwall/buntdb
|
||||||
go 1.15
|
go 1.15
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/tidwall/btree v0.2.2
|
github.com/tidwall/btree v0.3.0
|
||||||
github.com/tidwall/gjson v1.6.1
|
github.com/tidwall/gjson v1.6.7
|
||||||
github.com/tidwall/grect v0.0.0-20161006141115-ba9a043346eb
|
github.com/tidwall/grect v0.1.0
|
||||||
github.com/tidwall/match v1.0.1
|
github.com/tidwall/match v1.0.3
|
||||||
github.com/tidwall/rtree v0.0.0-20201027154624-32188eeb08a8
|
github.com/tidwall/rtree v0.1.0
|
||||||
github.com/tidwall/tinyqueue v0.0.0-20180302190814-1e39f5511563 // indirect
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
github.com/tidwall/btree v0.2.2 h1:VVo0JW/tdidNdQzNsDR4wMbL3heaxA1DGleyzQ3/niY=
|
github.com/tidwall/btree v0.3.0 h1:LcwmLI5kv+AaH/xnBgOuKfbu5eLBWVdWTpD2o+qSRdU=
|
||||||
github.com/tidwall/btree v0.2.2/go.mod h1:huei1BkDWJ3/sLXmO+bsCNELL+Bp2Kks9OLyQFkzvA8=
|
github.com/tidwall/btree v0.3.0/go.mod h1:huei1BkDWJ3/sLXmO+bsCNELL+Bp2Kks9OLyQFkzvA8=
|
||||||
github.com/tidwall/gjson v1.6.1 h1:LRbvNuNuvAiISWg6gxLEFuCe72UKy5hDqhxW/8183ws=
|
github.com/tidwall/gjson v1.6.7 h1:Mb1M9HZCRWEcXQ8ieJo7auYyyiSux6w9XN3AdTpxJrE=
|
||||||
github.com/tidwall/gjson v1.6.1/go.mod h1:BaHyNc5bjzYkPqgLq7mdVzeiRtULKULXLgZFKsxEHI0=
|
github.com/tidwall/gjson v1.6.7/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI=
|
||||||
github.com/tidwall/grect v0.0.0-20161006141115-ba9a043346eb h1:5NSYaAdrnblKByzd7XByQEJVT8+9v0W/tIY0Oo4OwrE=
|
github.com/tidwall/grect v0.1.0 h1:ICcKWD5uu5A5fmxApGIa0QRvfGnSWKRd07POT08CQSA=
|
||||||
github.com/tidwall/grect v0.0.0-20161006141115-ba9a043346eb/go.mod h1:lKYYLFIr9OIgdgrtgkZ9zgRxRdvPYsExnYBsEAd8W5M=
|
github.com/tidwall/grect v0.1.0/go.mod h1:sa5O42oP6jWfTShL9ka6Sgmg3TgIK649veZe05B7+J8=
|
||||||
github.com/tidwall/match v1.0.1 h1:PnKP62LPNxHKTwvHHZZzdOAOCtsJTjo6dZLCwpKm5xc=
|
github.com/tidwall/match v1.0.3 h1:FQUVvBImDutD8wJLN6c5eMzWtjgONK9MwIBCOrUJKeE=
|
||||||
github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E=
|
github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
||||||
github.com/tidwall/pretty v1.0.2 h1:Z7S3cePv9Jwm1KwS0513MRaoUe3S01WPbLNV40pwWZU=
|
github.com/tidwall/pretty v1.0.2 h1:Z7S3cePv9Jwm1KwS0513MRaoUe3S01WPbLNV40pwWZU=
|
||||||
github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
||||||
github.com/tidwall/rtree v0.0.0-20201027154624-32188eeb08a8 h1:BsKSRhu0TDB6Snq8SutN9KQHc6vqHEXJTcAFwyGNius=
|
github.com/tidwall/rtree v0.1.0 h1:w/RoiV3WvrKF/EzLaK6CT0MXAV6KveGy3EOyeJACoFA=
|
||||||
github.com/tidwall/rtree v0.0.0-20201027154624-32188eeb08a8/go.mod h1:/h+UnNGt0IhNNJLkGikcdcJqm66zGD/uJGMRxK/9+Ao=
|
github.com/tidwall/rtree v0.1.0/go.mod h1:xsujlpupsrYVnWaok1pqGtxhj9TKHSbMbY8eKPatQ4U=
|
||||||
github.com/tidwall/tinyqueue v0.0.0-20180302190814-1e39f5511563 h1:Otn9S136ELckZ3KKDyCkxapfufrqDqwmGjcHfAyXRrE=
|
github.com/tidwall/tinyqueue v0.1.1 h1:SpNEvEggbpyN5DIReaJ2/1ndroY8iyEGxPYxoSaymYE=
|
||||||
github.com/tidwall/tinyqueue v0.0.0-20180302190814-1e39f5511563/go.mod h1:mLqSmt7Dv/CNneF2wfcChfN1rvapyQr01LGKnKex0DQ=
|
github.com/tidwall/tinyqueue v0.1.1/go.mod h1:O/QNHwrnjqr6IHItYrzoHAKYhBkLI67Q096fQP5zMYw=
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
language: go
|
|
|
@ -3,13 +3,10 @@
|
||||||
src="logo.png"
|
src="logo.png"
|
||||||
width="240" height="78" border="0" alt="GJSON">
|
width="240" height="78" border="0" alt="GJSON">
|
||||||
<br>
|
<br>
|
||||||
<a href="https://travis-ci.org/tidwall/gjson"><img src="https://img.shields.io/travis/tidwall/gjson.svg?style=flat-square" alt="Build Status"></a>
|
|
||||||
<a href="https://godoc.org/github.com/tidwall/gjson"><img src="https://img.shields.io/badge/api-reference-blue.svg?style=flat-square" alt="GoDoc"></a>
|
<a href="https://godoc.org/github.com/tidwall/gjson"><img src="https://img.shields.io/badge/api-reference-blue.svg?style=flat-square" alt="GoDoc"></a>
|
||||||
<a href="http://tidwall.com/gjson-play"><img src="https://img.shields.io/badge/%F0%9F%8F%90-playground-9900cc.svg?style=flat-square" alt="GJSON Playground"></a>
|
<a href="http://tidwall.com/gjson-play"><img src="https://img.shields.io/badge/%F0%9F%8F%90-playground-9900cc.svg?style=flat-square" alt="GJSON Playground"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<p align="center">get json values quickly</a></p>
|
<p align="center">get json values quickly</a></p>
|
||||||
|
|
||||||
GJSON is a Go package that provides a [fast](#performance) and [simple](#get-a-value) way to get values from a json document.
|
GJSON is a Go package that provides a [fast](#performance) and [simple](#get-a-value) way to get values from a json document.
|
||||||
|
@ -476,7 +473,7 @@ JSON document used:
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Each operation was rotated though one of the following search paths:
|
Each operation was rotated through one of the following search paths:
|
||||||
|
|
||||||
```
|
```
|
||||||
widget.window.name
|
widget.window.name
|
||||||
|
@ -484,7 +481,7 @@ widget.image.hOffset
|
||||||
widget.text.onMouseUp
|
widget.text.onMouseUp
|
||||||
```
|
```
|
||||||
|
|
||||||
*These benchmarks were run on a MacBook Pro 15" 2.8 GHz Intel Core i7 using Go 1.8 and can be be found [here](https://github.com/tidwall/gjson-benchmarks).*
|
*These benchmarks were run on a MacBook Pro 15" 2.8 GHz Intel Core i7 using Go 1.8 and can be found [here](https://github.com/tidwall/gjson-benchmarks).*
|
||||||
|
|
||||||
|
|
||||||
## Contact
|
## Contact
|
||||||
|
|
|
@ -106,7 +106,8 @@ func (t Result) Bool() bool {
|
||||||
case True:
|
case True:
|
||||||
return true
|
return true
|
||||||
case String:
|
case String:
|
||||||
return t.Str != "" && t.Str != "0" && t.Str != "false"
|
b, _ := strconv.ParseBool(strings.ToLower(t.Str))
|
||||||
|
return b
|
||||||
case Number:
|
case Number:
|
||||||
return t.Num != 0
|
return t.Num != 0
|
||||||
}
|
}
|
||||||
|
@ -124,17 +125,18 @@ func (t Result) Int() int64 {
|
||||||
return n
|
return n
|
||||||
case Number:
|
case Number:
|
||||||
// try to directly convert the float64 to int64
|
// try to directly convert the float64 to int64
|
||||||
n, ok := floatToInt(t.Num)
|
i, ok := safeInt(t.Num)
|
||||||
if !ok {
|
if ok {
|
||||||
|
return i
|
||||||
|
}
|
||||||
// now try to parse the raw string
|
// now try to parse the raw string
|
||||||
n, ok = parseInt(t.Raw)
|
i, ok = parseInt(t.Raw)
|
||||||
if !ok {
|
if ok {
|
||||||
|
return i
|
||||||
|
}
|
||||||
// fallback to a standard conversion
|
// fallback to a standard conversion
|
||||||
return int64(t.Num)
|
return int64(t.Num)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return n
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Uint returns an unsigned integer representation.
|
// Uint returns an unsigned integer representation.
|
||||||
|
@ -149,17 +151,18 @@ func (t Result) Uint() uint64 {
|
||||||
return n
|
return n
|
||||||
case Number:
|
case Number:
|
||||||
// try to directly convert the float64 to uint64
|
// try to directly convert the float64 to uint64
|
||||||
n, ok := floatToUint(t.Num)
|
i, ok := safeInt(t.Num)
|
||||||
if !ok {
|
if ok && i >= 0 {
|
||||||
|
return uint64(i)
|
||||||
|
}
|
||||||
// now try to parse the raw string
|
// now try to parse the raw string
|
||||||
n, ok = parseUint(t.Raw)
|
u, ok := parseUint(t.Raw)
|
||||||
if !ok {
|
if ok {
|
||||||
|
return u
|
||||||
|
}
|
||||||
// fallback to a standard conversion
|
// fallback to a standard conversion
|
||||||
return uint64(t.Num)
|
return uint64(t.Num)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return n
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Float returns an float64 representation.
|
// Float returns an float64 representation.
|
||||||
|
@ -495,6 +498,9 @@ func squash(json string) string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if depth == 0 {
|
if depth == 0 {
|
||||||
|
if i >= len(json) {
|
||||||
|
return json
|
||||||
|
}
|
||||||
return json[:i+1]
|
return json[:i+1]
|
||||||
}
|
}
|
||||||
case '{', '[', '(':
|
case '{', '[', '(':
|
||||||
|
@ -1835,7 +1841,7 @@ type parseContext struct {
|
||||||
// A path is in dot syntax, such as "name.last" or "age".
|
// A path is in dot syntax, such as "name.last" or "age".
|
||||||
// When the value is found it's returned immediately.
|
// When the value is found it's returned immediately.
|
||||||
//
|
//
|
||||||
// A path is a series of keys searated by a dot.
|
// A path is a series of keys separated by a dot.
|
||||||
// A key may contain special wildcard characters '*' and '?'.
|
// A key may contain special wildcard characters '*' and '?'.
|
||||||
// To access an array value use the index as the key.
|
// To access an array value use the index as the key.
|
||||||
// To get the number of elements in an array or to access a child path, use
|
// To get the number of elements in an array or to access a child path, use
|
||||||
|
@ -1944,7 +1950,6 @@ func Get(json, path string) Result {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var i int
|
var i int
|
||||||
var c = &parseContext{json: json}
|
var c = &parseContext{json: json}
|
||||||
if len(path) >= 2 && path[0] == '.' && path[1] == '.' {
|
if len(path) >= 2 && path[0] == '.' && path[1] == '.' {
|
||||||
|
@ -2524,25 +2529,11 @@ func parseInt(s string) (n int64, ok bool) {
|
||||||
return n, true
|
return n, true
|
||||||
}
|
}
|
||||||
|
|
||||||
const minUint53 = 0
|
func safeInt(f float64) (n int64, ok bool) {
|
||||||
const maxUint53 = 4503599627370495
|
if f < -9007199254740991 || f > 9007199254740991 {
|
||||||
const minInt53 = -2251799813685248
|
|
||||||
const maxInt53 = 2251799813685247
|
|
||||||
|
|
||||||
func floatToUint(f float64) (n uint64, ok bool) {
|
|
||||||
n = uint64(f)
|
|
||||||
if float64(n) == f && n >= minUint53 && n <= maxUint53 {
|
|
||||||
return n, true
|
|
||||||
}
|
|
||||||
return 0, false
|
return 0, false
|
||||||
}
|
|
||||||
|
|
||||||
func floatToInt(f float64) (n int64, ok bool) {
|
|
||||||
n = int64(f)
|
|
||||||
if float64(n) == f && n >= minInt53 && n <= maxInt53 {
|
|
||||||
return n, true
|
|
||||||
}
|
}
|
||||||
return 0, false
|
return int64(f), true
|
||||||
}
|
}
|
||||||
|
|
||||||
// execModifier parses the path to find a matching modifier function.
|
// execModifier parses the path to find a matching modifier function.
|
||||||
|
@ -2600,7 +2591,7 @@ func execModifier(json, path string) (pathOut, res string, ok bool) {
|
||||||
// unwrap removes the '[]' or '{}' characters around json
|
// unwrap removes the '[]' or '{}' characters around json
|
||||||
func unwrap(json string) string {
|
func unwrap(json string) string {
|
||||||
json = trim(json)
|
json = trim(json)
|
||||||
if len(json) >= 2 && json[0] == '[' || json[0] == '{' {
|
if len(json) >= 2 && (json[0] == '[' || json[0] == '{') {
|
||||||
json = json[1 : len(json)-1]
|
json = json[1 : len(json)-1]
|
||||||
}
|
}
|
||||||
return json
|
return json
|
||||||
|
@ -2632,6 +2623,26 @@ func ModifierExists(name string, fn func(json, arg string) string) bool {
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// cleanWS remove any non-whitespace from string
|
||||||
|
func cleanWS(s string) string {
|
||||||
|
for i := 0; i < len(s); i++ {
|
||||||
|
switch s[i] {
|
||||||
|
case ' ', '\t', '\n', '\r':
|
||||||
|
continue
|
||||||
|
default:
|
||||||
|
var s2 []byte
|
||||||
|
for i := 0; i < len(s); i++ {
|
||||||
|
switch s[i] {
|
||||||
|
case ' ', '\t', '\n', '\r':
|
||||||
|
s2 = append(s2, s[i])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return string(s2)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
|
||||||
// @pretty modifier makes the json look nice.
|
// @pretty modifier makes the json look nice.
|
||||||
func modPretty(json, arg string) string {
|
func modPretty(json, arg string) string {
|
||||||
if len(arg) > 0 {
|
if len(arg) > 0 {
|
||||||
|
@ -2641,9 +2652,9 @@ func modPretty(json, arg string) string {
|
||||||
case "sortKeys":
|
case "sortKeys":
|
||||||
opts.SortKeys = value.Bool()
|
opts.SortKeys = value.Bool()
|
||||||
case "indent":
|
case "indent":
|
||||||
opts.Indent = value.String()
|
opts.Indent = cleanWS(value.String())
|
||||||
case "prefix":
|
case "prefix":
|
||||||
opts.Prefix = value.String()
|
opts.Prefix = cleanWS(value.String())
|
||||||
case "width":
|
case "width":
|
||||||
opts.Width = int(value.Int())
|
opts.Width = int(value.Int())
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,6 @@ module github.com/tidwall/gjson
|
||||||
go 1.12
|
go 1.12
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/tidwall/match v1.0.1
|
github.com/tidwall/match v1.0.3
|
||||||
github.com/tidwall/pretty v1.0.2
|
github.com/tidwall/pretty v1.0.2
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
github.com/tidwall/match v1.0.1 h1:PnKP62LPNxHKTwvHHZZzdOAOCtsJTjo6dZLCwpKm5xc=
|
github.com/tidwall/match v1.0.1 h1:PnKP62LPNxHKTwvHHZZzdOAOCtsJTjo6dZLCwpKm5xc=
|
||||||
github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E=
|
github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E=
|
||||||
|
github.com/tidwall/match v1.0.3 h1:FQUVvBImDutD8wJLN6c5eMzWtjgONK9MwIBCOrUJKeE=
|
||||||
|
github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
||||||
github.com/tidwall/pretty v1.0.2 h1:Z7S3cePv9Jwm1KwS0513MRaoUe3S01WPbLNV40pwWZU=
|
github.com/tidwall/pretty v1.0.2 h1:Z7S3cePv9Jwm1KwS0513MRaoUe3S01WPbLNV40pwWZU=
|
||||||
github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
module github.com/tidwall/grect
|
||||||
|
|
||||||
|
go 1.15
|
||||||
|
|
||||||
|
require github.com/tidwall/gjson v1.6.7
|
|
@ -0,0 +1,6 @@
|
||||||
|
github.com/tidwall/gjson v1.6.7 h1:Mb1M9HZCRWEcXQ8ieJo7auYyyiSux6w9XN3AdTpxJrE=
|
||||||
|
github.com/tidwall/gjson v1.6.7/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI=
|
||||||
|
github.com/tidwall/match v1.0.3 h1:FQUVvBImDutD8wJLN6c5eMzWtjgONK9MwIBCOrUJKeE=
|
||||||
|
github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
||||||
|
github.com/tidwall/pretty v1.0.2 h1:Z7S3cePv9Jwm1KwS0513MRaoUe3S01WPbLNV40pwWZU=
|
||||||
|
github.com/tidwall/pretty v1.0.2/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk=
|
|
@ -1 +0,0 @@
|
||||||
language: go
|
|
|
@ -1,20 +1,17 @@
|
||||||
Match
|
# Match
|
||||||
=====
|
|
||||||
<a href="https://travis-ci.org/tidwall/match"><img src="https://img.shields.io/travis/tidwall/match.svg?style=flat-square" alt="Build Status"></a>
|
[![GoDoc](https://godoc.org/github.com/tidwall/match?status.svg)](https://godoc.org/github.com/tidwall/match)
|
||||||
<a href="https://godoc.org/github.com/tidwall/match"><img src="https://img.shields.io/badge/api-reference-blue.svg?style=flat-square" alt="GoDoc"></a>
|
|
||||||
|
|
||||||
Match is a very simple pattern matcher where '*' matches on any
|
Match is a very simple pattern matcher where '*' matches on any
|
||||||
number characters and '?' matches on any one character.
|
number characters and '?' matches on any one character.
|
||||||
|
|
||||||
Installing
|
## Installing
|
||||||
----------
|
|
||||||
|
|
||||||
```
|
```
|
||||||
go get -u github.com/tidwall/match
|
go get -u github.com/tidwall/match
|
||||||
```
|
```
|
||||||
|
|
||||||
Example
|
## Example
|
||||||
-------
|
|
||||||
|
|
||||||
```go
|
```go
|
||||||
match.Match("hello", "*llo")
|
match.Match("hello", "*llo")
|
||||||
|
@ -23,10 +20,10 @@ match.Match("hello", "h*o")
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
Contact
|
## Contact
|
||||||
-------
|
|
||||||
Josh Baker [@tidwall](http://twitter.com/tidwall)
|
Josh Baker [@tidwall](http://twitter.com/tidwall)
|
||||||
|
|
||||||
License
|
## License
|
||||||
-------
|
|
||||||
Redcon source code is available under the MIT [License](/LICENSE).
|
Redcon source code is available under the MIT [License](/LICENSE).
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
module github.com/tidwall/match
|
||||||
|
|
||||||
|
go 1.15
|
|
@ -1,4 +1,4 @@
|
||||||
// Match provides a simple pattern matcher with unicode support.
|
// Package match provides a simple pattern matcher with unicode support.
|
||||||
package match
|
package match
|
||||||
|
|
||||||
import "unicode/utf8"
|
import "unicode/utf8"
|
||||||
|
@ -6,7 +6,7 @@ import "unicode/utf8"
|
||||||
// Match returns true if str matches pattern. This is a very
|
// Match returns true if str matches pattern. This is a very
|
||||||
// simple wildcard match where '*' matches on any number characters
|
// simple wildcard match where '*' matches on any number characters
|
||||||
// and '?' matches on any one character.
|
// and '?' matches on any one character.
|
||||||
|
//
|
||||||
// pattern:
|
// pattern:
|
||||||
// { term }
|
// { term }
|
||||||
// term:
|
// term:
|
||||||
|
@ -16,12 +16,16 @@ import "unicode/utf8"
|
||||||
// '\\' c matches character c
|
// '\\' c matches character c
|
||||||
//
|
//
|
||||||
func Match(str, pattern string) bool {
|
func Match(str, pattern string) bool {
|
||||||
|
return deepMatch(str, pattern)
|
||||||
|
}
|
||||||
|
|
||||||
|
func deepMatch(str, pattern string) bool {
|
||||||
if pattern == "*" {
|
if pattern == "*" {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return deepMatch(str, pattern)
|
for len(pattern) > 1 && pattern[0] == '*' && pattern[1] == '*' {
|
||||||
}
|
pattern = pattern[1:]
|
||||||
func deepMatch(str, pattern string) bool {
|
}
|
||||||
for len(pattern) > 0 {
|
for len(pattern) > 0 {
|
||||||
if pattern[0] > 0x7f {
|
if pattern[0] > 0x7f {
|
||||||
return deepMatchRune(str, pattern)
|
return deepMatchRune(str, pattern)
|
||||||
|
@ -52,6 +56,13 @@ func deepMatch(str, pattern string) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func deepMatchRune(str, pattern string) bool {
|
func deepMatchRune(str, pattern string) bool {
|
||||||
|
if pattern == "*" {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
for len(pattern) > 1 && pattern[0] == '*' && pattern[1] == '*' {
|
||||||
|
pattern = pattern[1:]
|
||||||
|
}
|
||||||
|
|
||||||
var sr, pr rune
|
var sr, pr rune
|
||||||
var srsz, prsz int
|
var srsz, prsz int
|
||||||
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
language: go
|
|
||||||
|
|
||||||
go:
|
|
||||||
- 1.6
|
|
|
@ -1,7 +1,8 @@
|
||||||
|
**This project has been archived. If you are looking for a high-performance Redis server for Go, please checkout [Redcon](https://github.com/tidwall/redcon). It's much faster than this implementation and can handle pipelining.**
|
||||||
|
|
||||||
RESP
|
RESP
|
||||||
====
|
====
|
||||||
|
|
||||||
[![Build Status](https://travis-ci.org/tidwall/resp.svg?branch=master)](https://travis-ci.org/tidwall/resp)
|
|
||||||
[![GoDoc](https://godoc.org/github.com/tidwall/resp?status.svg)](https://godoc.org/github.com/tidwall/resp)
|
[![GoDoc](https://godoc.org/github.com/tidwall/resp?status.svg)](https://godoc.org/github.com/tidwall/resp)
|
||||||
|
|
||||||
RESP is a [Go](http://golang.org/) library that provides a reader, writer, and server implementation for the [Redis RESP Protocol](http://redis.io/topics/protocol).
|
RESP is a [Go](http://golang.org/) library that provides a reader, writer, and server implementation for the [Redis RESP Protocol](http://redis.io/topics/protocol).
|
||||||
|
@ -11,7 +12,6 @@ While the protocol was designed specifically for Redis, it can be used for other
|
||||||
|
|
||||||
The RESP protocol has the advantages of being human readable and with performance of a binary protocol.
|
The RESP protocol has the advantages of being human readable and with performance of a binary protocol.
|
||||||
|
|
||||||
\*\* **Note: If you are looking for a high-performance Redis server for Go, please checkout [Redcon](https://github.com/tidwall/redcon). It's much faster than this implementation and can handle pipelining.** \*\*
|
|
||||||
|
|
||||||
Features
|
Features
|
||||||
--------
|
--------
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
language: go
|
|
|
@ -1,7 +1,6 @@
|
||||||
RTree implementation for Go
|
RTree implementation for Go
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
[![Build Status](https://travis-ci.org/tidwall/rtree.svg?branch=master)](https://travis-ci.org/tidwall/rtree)
|
|
||||||
[![GoDoc](https://godoc.org/github.com/tidwall/rtree?status.svg)](https://godoc.org/github.com/tidwall/rtree)
|
[![GoDoc](https://godoc.org/github.com/tidwall/rtree?status.svg)](https://godoc.org/github.com/tidwall/rtree)
|
||||||
|
|
||||||
This package provides an in-memory R-Tree implementation for Go, useful as a spatial data structure.
|
This package provides an in-memory R-Tree implementation for Go, useful as a spatial data structure.
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
module github.com/tidwall/rtree
|
||||||
|
|
||||||
|
go 1.15
|
||||||
|
|
||||||
|
require github.com/tidwall/tinyqueue v0.1.1
|
|
@ -0,0 +1,2 @@
|
||||||
|
github.com/tidwall/tinyqueue v0.1.1 h1:SpNEvEggbpyN5DIReaJ2/1ndroY8iyEGxPYxoSaymYE=
|
||||||
|
github.com/tidwall/tinyqueue v0.1.1/go.mod h1:O/QNHwrnjqr6IHItYrzoHAKYhBkLI67Q096fQP5zMYw=
|
|
@ -0,0 +1,3 @@
|
||||||
|
module github.com/tidwall/tinyqueue
|
||||||
|
|
||||||
|
go 1.15
|
|
@ -81,7 +81,7 @@ github.com/mmcloughlin/geohash
|
||||||
github.com/nats-io/go-nats
|
github.com/nats-io/go-nats
|
||||||
github.com/nats-io/go-nats/encoders/builtin
|
github.com/nats-io/go-nats/encoders/builtin
|
||||||
github.com/nats-io/go-nats/util
|
github.com/nats-io/go-nats/util
|
||||||
# github.com/nats-io/nuid v1.0.0
|
# github.com/nats-io/nuid v1.0.1
|
||||||
github.com/nats-io/nuid
|
github.com/nats-io/nuid
|
||||||
# github.com/peterh/liner v1.2.0
|
# github.com/peterh/liner v1.2.0
|
||||||
github.com/peterh/liner
|
github.com/peterh/liner
|
||||||
|
@ -92,9 +92,9 @@ github.com/pierrec/lz4/internal/xxh32
|
||||||
github.com/rcrowley/go-metrics
|
github.com/rcrowley/go-metrics
|
||||||
# github.com/streadway/amqp v1.0.0
|
# github.com/streadway/amqp v1.0.0
|
||||||
github.com/streadway/amqp
|
github.com/streadway/amqp
|
||||||
# github.com/tidwall/btree v0.2.2
|
# github.com/tidwall/btree v0.3.0
|
||||||
github.com/tidwall/btree
|
github.com/tidwall/btree
|
||||||
# github.com/tidwall/buntdb v1.1.4
|
# github.com/tidwall/buntdb v1.1.8
|
||||||
github.com/tidwall/buntdb
|
github.com/tidwall/buntdb
|
||||||
# github.com/tidwall/geoindex v1.1.0
|
# github.com/tidwall/geoindex v1.1.0
|
||||||
github.com/tidwall/geoindex
|
github.com/tidwall/geoindex
|
||||||
|
@ -103,30 +103,30 @@ github.com/tidwall/geoindex/child
|
||||||
github.com/tidwall/geojson
|
github.com/tidwall/geojson
|
||||||
github.com/tidwall/geojson/geo
|
github.com/tidwall/geojson/geo
|
||||||
github.com/tidwall/geojson/geometry
|
github.com/tidwall/geojson/geometry
|
||||||
# github.com/tidwall/gjson v1.6.1
|
# github.com/tidwall/gjson v1.6.7
|
||||||
github.com/tidwall/gjson
|
github.com/tidwall/gjson
|
||||||
# github.com/tidwall/grect v0.0.0-20161006141115-ba9a043346eb
|
# github.com/tidwall/grect v0.1.0
|
||||||
github.com/tidwall/grect
|
github.com/tidwall/grect
|
||||||
# github.com/tidwall/match v1.0.1
|
# github.com/tidwall/match v1.0.3
|
||||||
github.com/tidwall/match
|
github.com/tidwall/match
|
||||||
# github.com/tidwall/pretty v1.0.2
|
# github.com/tidwall/pretty v1.0.2
|
||||||
github.com/tidwall/pretty
|
github.com/tidwall/pretty
|
||||||
# github.com/tidwall/rbang v1.2.2
|
# github.com/tidwall/rbang v1.2.2
|
||||||
github.com/tidwall/rbang
|
github.com/tidwall/rbang
|
||||||
# github.com/tidwall/redbench v0.0.0-20181110173744-17c5b5b864a4
|
# github.com/tidwall/redbench v0.1.0
|
||||||
github.com/tidwall/redbench
|
github.com/tidwall/redbench
|
||||||
# github.com/tidwall/redcon v1.3.2
|
# github.com/tidwall/redcon v1.3.2
|
||||||
github.com/tidwall/redcon
|
github.com/tidwall/redcon
|
||||||
# github.com/tidwall/resp v0.0.0-20160908231031-b2b1a7ca20e3
|
# github.com/tidwall/resp v0.1.0
|
||||||
github.com/tidwall/resp
|
github.com/tidwall/resp
|
||||||
# github.com/tidwall/rhh v1.1.0
|
# github.com/tidwall/rhh v1.1.0
|
||||||
github.com/tidwall/rhh
|
github.com/tidwall/rhh
|
||||||
# github.com/tidwall/rtree v0.0.0-20201027154624-32188eeb08a8
|
# github.com/tidwall/rtree v0.1.0
|
||||||
github.com/tidwall/rtree
|
github.com/tidwall/rtree
|
||||||
github.com/tidwall/rtree/base
|
github.com/tidwall/rtree/base
|
||||||
# github.com/tidwall/sjson v1.1.1
|
# github.com/tidwall/sjson v1.1.1
|
||||||
github.com/tidwall/sjson
|
github.com/tidwall/sjson
|
||||||
# github.com/tidwall/tinyqueue v0.0.0-20180302190814-1e39f5511563
|
# github.com/tidwall/tinyqueue v0.1.1
|
||||||
github.com/tidwall/tinyqueue
|
github.com/tidwall/tinyqueue
|
||||||
# github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da
|
# github.com/yuin/gopher-lua v0.0.0-20200816102855-ee81675732da
|
||||||
github.com/yuin/gopher-lua
|
github.com/yuin/gopher-lua
|
||||||
|
|
Loading…
Reference in New Issue