Comments (8)
What does the generated model look like?
from sqlboiler.
@stephenafamo: I updated the example for better clarity and added the generated model
from sqlboiler.
The issue is your config. You're missing something with the TOML syntax and you're using double square brackets where single square brackets should be used.
add-enum-types = true
[[types]]
[types.match]
name = "my_enum"
# tables = ["TableA"]
[types.replace]
type = "models_types.MyEnumOverride"
[types.imports]
third_party = ['"test.com/test/models_types"']
It would be a cleaner experience to replace their types with 1 self-created oneβ¦
Side note, you can just replace one of the enums with the second auto generated one so that you don't have to maintain the values yourself π€·πΎββοΈ
from sqlboiler.
you're using double square brackets where single square brackets should be used
That's it. Thanks!
One problem left, though: sqlboiler still auto-generates type TableAMyEnum string
into boil_types.go
you can just replace one of the enums with the second auto generated one
Indeed
from sqlboiler.
One problem left, though: sqlboiler still auto-generates
type TableAMyEnum string
into boil_types.go
Not really an issue since there is no way for SQLBoiler to be sure that you do not intend to use the type somewhere else.
from sqlboiler.
Not really an issue since there is no way for SQLBoiler to be sure that you do not intend to use the type somewhere else.
If sqlboiler creates a type specifically for that field in that table and I tell sqlboiler to replace it in the generated model, then it makes no sense to keep it.
So that reasoning makes little sense to me. But if you must insist, I propose to add a flag to "skip fully replaced (enum) types"
from sqlboiler.
I can see why this would be useful.
If you can send in a PR with this flag, I'll be happy to review and merge.
from sqlboiler.
Thank you. I'll see to it. If you have some useful pointers (like where the replacement takes place), I'd appreciate it a lot!
from sqlboiler.
Related Issues (20)
- types.Hstore does not works HOT 1
- Foreign key causes "panic: interface conversion: string is not error: missing method Error" HOT 1
- Error: can't evaluate field IsView in type drivers.Table HOT 2
- Bug/breaking change on upsert with postgres in v4.16.0 HOT 1
- OrWhere wrong in docs HOT 2
- `json_extract` not working with `Bind` HOT 1
- sqlboiler model generation not working with Vitess (MySQL CNFC scalable) due to subqueries HOT 1
- After specifying tag-ignore , sqlboiler is failing to generate the code HOT 3
- Timestamps in sqlite HOT 1
- Increase Depth Limit in ptrFromMapping Function for Deeper Structure Access in reflect.go
- SqlBoiler generates wrong table struct name HOT 2
- Compilation Errors with TIMESTAMP Columns in sqlite3 Driver
- Sqlite view model has wrong type and can't be replaced HOT 3
- Updating jsonb fields
- Switch to a different table but with the same schema while inserting the record
- Fix comment position of first column of table HOT 1
- Applying where clause for multiple table before joins using qm.Rels() HOT 1
- UUID used as a primary key causes panic when loading HOT 6
- Add custom tags for specific colum(s) in table(s) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqlboiler.