Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type-safe terms #2

Open
NotJustAnna opened this issue Mar 3, 2020 · 0 comments
Open

Type-safe terms #2

NotJustAnna opened this issue Mar 3, 2020 · 0 comments

Comments

@NotJustAnna
Copy link
Member

NotJustAnna commented Mar 3, 2020

What is this?

Make a list of valid argument types, valid optargs keys with valid value types for each key., preferably in JSON.

Example

{
    "TABLE": {
        "arguments": [
            [
                {"type": "DATUM", "datumType": "T_STRING"}
            ],
            [
                {"type": "DB"},
                {"type": "DATUM", "datumType": "T_STRING"}
            ]
        ],
        "optArgs": {
            "read_mode": {"acceptedValues": ["majority", "single", "outdated"]},
            "identifier_format": {"acceptedValues": ["name", "uuid"]}
        }
    } 
}

Source of knowledge

https://github.com/rethinkdb/rethinkdb/tree/next/src/rdb_protocol/terms

Things to keep in mind

According to srh:

E.g., to pick a random file, https://github.com/rethinkdb/rethinkdb/blob/next/src/rdb_protocol/terms/db_table.cc , you can see the table_term_t showing the r.table term takes 1-2 arguments and three optargs, where the constructor takes an argspec_t and an optargspec_t. But then the body of the function describes what constitutes a valid set of arguments. (E.g. with 1 argument, it must be a table name, with 2 arguments, there must be a db term and a table name.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant