Skip to content

Commit 1a83350

Browse files
authored
Merge pull request #795 from erizocosmico/feature/import-gms-docs
tools: make upgrade tool copy docs from go-mysql-server
2 parents fd71314 + 9675cda commit 1a83350

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3369
-258
lines changed

Gopkg.lock

Lines changed: 3 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[[constraint]]
22
name = "gopkg.in/src-d/go-mysql-server.v0"
3-
revision = "3dd441325d1731821eff0495fbf63747c258b8ff"
3+
revision = "bb5fe96ff756e5b25ec53c68c92d92c108832a65"
44

55
[[constraint]]
66
name = "github.com/jessevdk/go-flags"
@@ -84,7 +84,6 @@
8484
[[prune.project]]
8585
name = "gopkg.in/src-d/go-mysql-server.v0"
8686
go-tests = true
87-
non-go = true
8887
unused-packages = true
8988
[[prune.project]]
9089
name = "gopkg.in/src-d/go-git.v4"

cmd/gitbase/command/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ func (c *Server) buildDatabase() error {
219219
c.engine.Catalog.SetCurrentDatabase(c.Name)
220220
logrus.WithField("db", c.Name).Debug("registered database to catalog")
221221

222-
c.engine.Catalog.RegisterFunctions(function.Functions)
222+
c.engine.Catalog.MustRegister(function.Functions...)
223223
logrus.Debug("registered all available functions in catalog")
224224

225225
if err := c.registerDrivers(); err != nil {

docs/using-gitbase/configuration.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,20 @@
1919
| `GITBASE_MAX_UAST_BLOB_SIZE` | Max size of blobs to send to be parsed by bblfsh. Default: 5242880 (5MB) |
2020
| `GITBASE_LOG_LEVEL` | minimum logging level to show, use `fatal` to suppress most messages. Default: `info` |
2121

22+
## Configuration from `go-mysql-server`
23+
24+
<!-- BEGIN CONFIG -->
25+
| Name | Type | Description |
26+
|:-----|:-----|:------------|
27+
|`INMEMORY_JOINS`|environment|If set it will perform all joins in memory. Default is off.|
28+
|`inmemory_joins`|session|If set it will perform all joins in memory. Default is off. This has precedence over `INMEMORY_JOINS`.|
29+
|`MAX_MEMORY_INNER_JOIN`|environment|The maximum number of memory, in megabytes, that can be consumed by go-mysql-server before switching to multipass mode in inner joins. Default is the 20% of all available physical memory.|
30+
|`max_memory_joins`|session|The maximum number of memory, in megabytes, that can be consumed by go-mysql-server before switching to multipass mode in inner joins. Default is the 20% of all available physical memory. This has precedence over `MAX_MEMORY_INNER_JOIN`.|
31+
|`DEBUG_ANALYZER`|environment|If set, the analyzer will print debug messages. Default is off.|
32+
|`PILOSA_INDEX_THREADS`|environment|Number of threads used in index creation. Default is the number of cores available in the machine.|
33+
|`pilosa_index_threads`|environment|Number of threads used in index creation. Default is the number of cores available in the machine. This has precedence over `PILOSA_INDEX_THREADS`.|
34+
<!-- END CONFIG -->
35+
2236
### Jaeger tracing variables
2337

2438
*Extracted from https://github.com/jaegertracing/jaeger-client-go/blob/master/README.md*

docs/using-gitbase/functions.md

Lines changed: 73 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,80 @@ To make some common tasks easier for the user, there are some functions to inter
66

77
| Name | Description |
88
|:-------------|:-------------------------------------------------------------------------------------------------------------------------------|
9-
|is_remote(reference_name)bool| check if the given reference name is from a remote one |
10-
|is_tag(reference_name)bool| check if the given reference name is a tag |
11-
|language(path, [blob])text| gets the language of a file given its path and the optional content of the file |
12-
|uast(blob, [lang, [xpath]]) blob| returns a node array of UAST nodes in semantic mode |
13-
|uast_mode(mode, blob, lang) blob| returns a node array of UAST nodes specifying its language and mode (semantic, annotated or native) |
14-
|uast_xpath(blob, xpath) blob| performs an XPath query over the given UAST nodes |
15-
|uast_extract(blob, key) text array| extracts information identified by the given key from the uast nodes |
16-
|uast_children(blob) blob| returns a flattened array of the children UAST nodes from each one of the UAST nodes in the given array |
9+
|`is_remote(reference_name)bool`| check if the given reference name is from a remote one |
10+
|`is_tag(reference_name)bool`| check if the given reference name is a tag |
11+
|`language(path, [blob])text`| gets the language of a file given its path and the optional content of the file |
12+
|`uast(blob, [lang, [xpath]]) blob`| returns a node array of UAST nodes in semantic mode |
13+
|`uast_mode(mode, blob, lang) blob`| returns a node array of UAST nodes specifying its language and mode (semantic, annotated or native) |
14+
|`uast_xpath(blob, xpath) blob`| performs an XPath query over the given UAST nodes |
15+
|`uast_extract(blob, key) text array`| extracts information identified by the given key from the uast nodes |
16+
|`uast_children(blob) blob`| returns a flattened array of the children UAST nodes from each one of the UAST nodes in the given array |
1717

18+
## Standard functions
19+
20+
These are all functions that are available because they are implemented in `go-mysql-server`, used by gitbase.
21+
22+
<!-- BEGIN FUNCTIONS -->
23+
| Name | Description |
24+
|:-------------|:-------------------------------------------------------------------------------------------------------------------------------|
25+
|`ARRAY_LENGTH(json)`|If the json representation is an array, this function returns its size.|
26+
|`AVG(expr)`|Returns the average value of expr in all rows.|
27+
|`CEIL(number)`|Return the smallest integer value that is greater than or equal to `number`.|
28+
|`CEILING(number)`|Return the smallest integer value that is greater than or equal to `number`.|
29+
|`COALESCE(...)`|The function returns the first non-null value in a list.|
30+
|`CONCAT(...)`|Concatenate any group of fields into a single string.|
31+
|`CONCAT_WS(sep, ...)`|Concatenate any group of fields into a single string. The first argument is the separator for the rest of the arguments. The separator is added between the strings to be concatenated. The separator can be a string, as can the rest of the arguments. If the separator is NULL, the result is NULL.|
32+
|`CONNECTION_ID()`|Return the current connection ID.|
33+
|`COUNT(expr)`| Returns a count of the number of non-NULL values of expr in the rows retrieved by a SELECT statement.|
34+
|`DATE_ADD(date, interval)`|Adds the interval to the given date.|
35+
|`DATE_SUB(date, interval)`|Subtracts the interval from the given date.|
36+
|`DAY(date)`|Synonym for DAYOFMONTH().|
37+
|`DATE(date)`|Returns the date part of the given date.|
38+
|`DAYOFMONTH(date)`|Return the day of the month (0-31).|
39+
|`DAYOFWEEK(date)`|Returns the day of the week of the given date.|
40+
|`DAYOFYEAR(date)`|Returns the day of the year of the given date.|
41+
|`FLOOR(number)`|Return the largest integer value that is less than or equal to `number`.|
42+
|`HOUR(date)`|Returns the hours of the given date.|
43+
|`IFNULL(expr1, expr2)`|If expr1 is not NULL, IFNULL() returns expr1; otherwise it returns expr2.|
44+
|`IS_BINARY(blob)`|Returns whether a BLOB is a binary file or not.|
45+
|`JSON_EXTRACT(json_doc, path, ...)`|Extracts data from a json document using json paths.|
46+
|`LN(X)`|Return the natural logarithm of X.|
47+
|`LOG(X), LOG(B, X)`|If called with one parameter, this function returns the natural logarithm of X. If called with two parameters, this function returns the logarithm of X to the base B. If X is less than or equal to 0, or if B is less than or equal to 1, then NULL is returned.|
48+
|`LOG10(X)`|Returns the base-10 logarithm of X.|
49+
|`LOG2(X)`|Returns the base-2 logarithm of X.|
50+
|`LOWER(str)`|Returns the string str with all characters in lower case.|
51+
|`LPAD(str, len, padstr)`|Return the string argument, left-padded with the specified string.|
52+
|`LTRIM(str)`|Returns the string str with leading space characters removed.|
53+
|`MAX(expr)`|Returns the maximum value of expr in all rows.|
54+
|`MID(str, pos, [len])`|Return a substring from the provided string starting at `pos` with a length of `len` characters. If no `len` is provided, all characters from `pos` until the end will be taken.|
55+
|`MIN(expr)`|Returns the minimum value of expr in all rows.|
56+
|`MINUTE(date)`|Returns the minutes of the given date.|
57+
|`MONTH(date)`|Returns the month of the given date.|
58+
|`NOW()`|Returns the current timestamp.|
59+
|`NULLIF(expr1, expr2)`|Returns NULL if expr1 = expr2 is true, otherwise returns expr1.|
60+
|`POW(X, Y)`|Returns the value of X raised to the power of Y.|
61+
|`REPEAT(str, count)`|Returns a string consisting of the string str repeated count times.|
62+
|`REPLACE(str,from_str,to_str)`|Returns the string str with all occurrences of the string from_str replaced by the string to_str.|
63+
|`REVERSE(str)`|Returns the string str with the order of the characters reversed.|
64+
|`ROUND(number, decimals)`|Round the `number` to `decimals` decimal places.|
65+
|`RPAD(str, len, padstr)`|Returns the string str, right-padded with the string padstr to a length of len characters.|
66+
|`RTRIM(str)`|Returns the string str with trailing space characters removed.|
67+
|`SECOND(date)`|Returns the seconds of the given date.|
68+
|`SLEEP(seconds)`|Wait for the specified number of seconds (can be fractional).|
69+
|`SOUNDEX(str)`|Returns the soundex of a string.|
70+
|`SPLIT(str,sep)`|Receives a string and a separator and returns the parts of the string split by the separator as a JSON array of strings.|
71+
|`SQRT(X)`|Returns the square root of a nonnegative number X.|
72+
|`SUBSTR(str, pos, [len])`|Return a substring from the provided string starting at `pos` with a length of `len` characters. If no `len` is provided, all characters from `pos` until the end will be taken.|
73+
|`SUBSTRING(str, pos, [len])`|Return a substring from the provided string starting at `pos` with a length of `len` characters. If no `len` is provided, all characters from `pos` until the end will be taken.|
74+
|`SUM(expr)`|Returns the sum of expr in all rows.|
75+
|`TO_BASE64(str)`|Encodes the string str in base64 format.|
76+
|`FROM_BASE64(str)`|Decodes the base64-encoded string str.|
77+
|`TRIM(str)`|Returns the string str with all spaces removed.|
78+
|`UPPER(str)`|Returns the string str with all characters in upper case.|
79+
|`WEEKDAY(date)`|Returns the weekday of the given date.|
80+
|`YEAR(date)`|Returns the year of the given date.|
81+
|`YEARWEEK(date, mode)`|Returns year and week for a date. The year in the result may be different from the year in the date argument for the first and the last week of the year.|
82+
<!-- END FUNCTIONS -->
1883

1984
## Note about uast, uast_mode, uast_xpath and uast_children functions
2085

@@ -92,7 +157,3 @@ Nodes that have no value for the requested property will not be present in any w
92157
Also, if you want to retrieve values from a non common property, you can pass it directly
93158

94159
> uast_extract(nodes_column, 'some-property')
95-
96-
## Standard functions
97-
98-
You can check standard functions in [`go-mysql-server` documentation](https://github.com/src-d/go-mysql-server/tree/3dd441325d1731821eff0495fbf63747c258b8ff#custom-functions).

docs/using-gitbase/indexes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ and for the second query also two indexes will be used and the result will be a
2626

2727
You can find some more examples in the [examples](./examples.md#create-an-index-for-columns-on-a-table) section.
2828

29-
See [go-mysql-server](https://github.com/src-d/go-mysql-server/tree/3dd441325d1731821eff0495fbf63747c258b8ff#indexes) documentation for more details
29+
See [go-mysql-server](https://github.com/src-d/go-mysql-server/tree/bb5fe96ff756e5b25ec53c68c92d92c108832a65#indexes) documentation for more details

0 commit comments

Comments
 (0)