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

Add -mixedcaps option to edgeql-go #262

Merged
merged 1 commit into from
May 1, 2023
Merged

Add -mixedcaps option to edgeql-go #262

merged 1 commit into from
May 1, 2023

Conversation

fmoor
Copy link
Member

@fmoor fmoor commented Feb 14, 2023

The new -mixedcaps option changes snake_case names in shapes to MixedCaps names in go structs.

select User {
    first_name,
    last_name,
}

Becomes:

type MyQueryResult struct {
    FirstName string `edgedb:"first_name"`
    LastName  string `edgedb:"last_name"`
}

Without this option enabled names are used exactly as they appear in shapes. For example the query above would produce the following struct:

type MyQueryResult struct {
    first_name string `edgedb:"first_name"`
    last_name  string `edgedb:"last_name"`
}

working on #245

The new `-mixedcaps` option changes snake_case names in shapes to
MixedCaps names in go structs.

```
select User {
    first_name,
    last_name,
}
```

Becomes:
```go
type MyQueryResult struct {
    FirstName string `edgedb:"first_name"`
    LastName  string `edgedb:"last_name"`
}
```

Without this option enabled names are used exactly as they appear in
shapes. For example the query above would produce the following struct:
```go
type MyQueryResult struct {
    first_name string `edgedb:"first_name"`
    last_name  string `edgedb:"last_name"`
}
```

working on #245
@sebastiean
Copy link

Can this be reviewed? It would be an extremely useful feature

Copy link
Member

@fantix fantix left a comment

Choose a reason for hiding this comment

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

Sorry for the delay! I think this is good.

@fmoor fmoor merged commit 7043f73 into master May 1, 2023
@fmoor fmoor deleted the gen-opts branch May 1, 2023 17:18
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.

3 participants