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

Schema generation support #12

Merged
merged 4 commits into from
Mar 6, 2019
Merged

Schema generation support #12

merged 4 commits into from
Mar 6, 2019

Conversation

penberg
Copy link
Contributor

@penberg penberg commented Feb 12, 2019

This pull request implement schema generation in the Gemini tool. Previously, schema was configured via an external file, schema.json. This adds a --schema command line option, which users can use for the old behavior. If no schema file is configured, the tool generates one.

Fixes #9.

The error condition in generateValue() is ignored because the error
object created with fmt.Errorf() is not returned anywhere. As this is an
internal error, let's just call panic() to stop execution.
The schema is currently configured via an external file "schema.json".
This commit adds support for generating the schema with the tool. Users
can still define the schema themselves via a JSON file with the
"--schema" command line option.

Fixes #9
@penberg penberg force-pushed the schema-gen branch 2 times, most recently from 1a4e095 to ee16b56 Compare February 12, 2019 13:04
func GenSchema() *Schema {
builder := NewSchemaBuilder()
keyspace := Keyspace{
Name: "ks1",
Copy link
Contributor

@dahankzter dahankzter Mar 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the ks1 a convention? In the old config file it was called gemini or perhaps this is a different keyspace?

columns = append(columns, ColumnDef{Name: genColumnName("col", i), Type: genColumnType()})
}
table := Table{
Name: "table1",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as the keyspace above. Are they keys into a config?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original configuration keyspace and table names were picked at random, like the ones here too. The benefit of this convention is that we can generate multiple keyspaces and tables at a later point.

@penberg penberg merged commit c458b61 into master Mar 6, 2019
@penberg penberg deleted the schema-gen branch March 12, 2019 08:11
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

Successfully merging this pull request may close these issues.

2 participants