Giter Club home page Giter Club logo

querydsl-utils's Introduction

Build Status codecov Maven Central

QueryDSL Utils

Select

Select uses meta information generated by Metafy to bind query values to DTO values.

Example:

QAuthor author = QAuthor.author;
MAuthorDto meta = MAuthorDto.meta;

Select<AuthorDto> select = new Select<>(AuthorDto.class);
select.as(author.id, meta.id);
select.as(author.name, meta.name);

JPAQuery<AuthorDto> query = new JPAQuery<>(em);
query.from(author);

List<AuthorDto> authors = query.select(select).fetch();

Using converters:

QAuthor author = QAuthor.author;
MAuthorDto meta = MAuthorDto.meta;

Select<AuthorDto> select = new Select<>(AuthorDto.class);
select.as(author.id, meta.id);
select.as(author.name, meta.name, name -> name + "_converted-name");

JPAQuery<AuthorDto> query = new JPAQuery<>(em);
query.from(author);

List<AuthorDto> authors = query.select(select).fetch();

QueryWrapper

Adds utilities to the Query.

Paging example:

QAuthor author = QAuthor.author;
MAuthorDto meta = MAuthorDto.meta;

Select<AuthorDto> select = new Select<>(AuthorDto.class);
select.as(author.id, meta.id);
select.as(author.name, meta.name);

JPAQuery<AuthorDto> query = new JPAQuery<>(em);
query.from(author);
query.select(select);

QueryWrapper<AuthorDto, JPAQuery<AuthorDto>> wrapper = QueryWrapper.wrap(query);

PageSpec pageSpec = new PageSpec(0, 1, null);

PageResult<AuthorDto> result = wrapper.fetchPage(pageSpec);

querydsl-utils's People

Contributors

antoniotaha avatar fliptaboada avatar carlosbonetti avatar lucasjoao avatar fernandobt8 avatar dependabot[bot] avatar

Watchers

James Cloos avatar Lucas Petroski avatar Alexandre Mattje avatar Fernando Agostinho avatar Rodrigo A. Costa avatar Wagner Braga dos Santos avatar Dúnia avatar Talles Cesar avatar Yuri Kayser avatar  avatar  avatar Nathália Liz avatar Lucas Postal avatar Franco Rafael avatar Fabio Reibnitz avatar Odilon Ferreira avatar  avatar Fabricio Matos avatar  avatar  avatar Nathan Werlich avatar  avatar Cristiano avatar  avatar

querydsl-utils's Issues

(2) Migrar do travis ci para github actions

É necessário uma mudança na configuração do travis ci para ainda ser possível o seu uso.

Ao invés de atualizar essa configuração, será então migrado para o github actions, o que fica mais de acordo com os outros repositórios do laboratório Bridge.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.