Hi,
I have been messing around with some of the codegen on a side project and was hoping I could get some feedback. Its still very early stage but I would like the best way to show an example.
Assume I have the following mysql schema.
CREATE TABLE `person` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`email` varchar(255) NOT NULL,
`first_name` varchar(255) DEFAULT NULL,
`last_name` varchar(255) DEFAULT NULL,
`age` int NOT NULL,
`ts_created` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `email_idx` (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
My code currently adds something like this.
Person person = PersonDao.select()
.firstName("bill")
.lastName("O'Neil)
.fetchOne()
This allows you to build queries using multiple columns directly from the DAO instead of just using fetchByFirstName(), fetchByLastName(). It also exposes methods which give you direct access to the table fields so you can do the following.
List<Person> people = PersonDao.select()
.firstName(firstName -> firstName.startsWith("bi"))
.lastName(lastName -> lastName.startsWith("O'Ne"))
.fetchAll()
Two questions.
1. Does anything like this already exist?
2. What would be the best way to show a full example for some feedback if it does not exist.
I built an example object that works with the above queries and I am almost finished with the code generation part which will auto generate the sql builder for each DaoObject.
Thanks, Bill