Comments (7)
@tarqe39 Hi, thank you very much for your interest. Would you like to provide a more detail example for this? :)
from modelq.
I need to use sqlx, custom context and so on, so gmq will not work for me.
It would be nice if i could define my own template with sections /fragments that correspond to your templates(in templates.go). The tool would then generate code from my templates.
I could do a pull request if you want so you can see what i mean.
from modelq.
@tarqe39 Ah, got you, would you like to provide me a sample of the target code or the template so I can generalize this feature? Thank you very much.
from modelq.
content of template doesnt matter, it can be anything. idea is to load file with multiple sections and render them instead of current templates. they would replace current templates tmHeader, tmStruct, tmObjApi, tmQueryApi, tmManagedObjApi.
here is a sample for single template with multiple sections.
http://play.golang.org/p/Q3NMOymzfT
you would call CLI with something like modelq -db="root@/blog" -pkg=mysql -tables=user,article -driver=mysql -schema=blog -templates=myTemplates.tmpl
from modelq.
Got it, make sense to me, will do this, :)
from modelq.
Hi @tarqe39 sorry for so late, have been kept busy for these days. I kinda commit the feature into master and now the template is supported. Please check the examples/custom.tmpl for example and the generated codes are listed in examples/custom.
Please let me know if the basic fragments or the template arguments are not enough for you requirements. :)
from modelq.
Haven't tried it yet, but I looked at changes and example and it looks good :) thx
from modelq.
Related Issues (19)
- Problem with Multi-Column Primary Key in MySQL HOT 3
- Joins HOT 6
- Make it easier to generate sqlx code HOT 3
- Support your own queries (for custom things like full text queries) HOT 10
- Looks awesome, any plans to support PostgreSQL? HOT 2
- is this project still active? HOT 5
- dont-touch-timestamp=true is treated as CodeGen.TouchTimestamp=true HOT 1
- time fields with default value CURRENT_TIMESTAMP(X) in sql are still written to with dont-touch-timestamp=True flag HOT 2
- 'json:' tags for fields should support camelCase as a config HOT 1
- Code generated from table with no primary key does not compile
- Prepared statements should close HOT 1
- Plans for aggregate functions?
- modelq does not remove deprecated files HOT 1
- Consideration of Slick code base for some of the complex join tasks HOT 1
- Queries should not silently fail when iterating over the result set
- Postgres date fields become strings HOT 1
- Columns should have type safety HOT 4
- Support of Postgres < 8.2 HOT 4
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 modelq.