All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.zodiac.fastorm.rdb.mapping.DSLQuery Maven / Gradle / Ivy

The newest version!
package org.zodiac.fastorm.rdb.mapping;

import org.zodiac.fastorm.core.Conditional;
import org.zodiac.fastorm.core.MethodReferenceColumn;
import org.zodiac.fastorm.core.StaticMethodReferenceColumn;
import org.zodiac.fastorm.core.param.QueryParam;
import org.zodiac.fastorm.rdb.operator.dml.SortOrderSupplier;
import org.zodiac.fastorm.rdb.operator.dml.query.SortOrder;

import java.util.Map;

/**
 * The dynamic DSL query API is used to construct dynamic query conditions in DSL mode.
 *
 * @param  The type that implements this interface.
 * @see QueryParam
 */
public interface DSLQuery> extends Conditional {

    /**
     * Query for the specified attributes(columns).
     *
     * @param columns The attributes(columns).
     * @return This.
     */
    ME select(String... columns);

    /**
     * The specified attributes(columns) is not queried.
     *
     * @param columns The attributes(columns).
     * @return This.
     */
    ME selectExcludes(String... columns);

    /**
     * Use a {@code getter static} method reference to specify the properties of the query.
*
{@code
     * createQuery()
     * .select(User::getName)
     * .fetch()
     * }
* * @param columns The columns. * @param Type. * @return This. */ ME select(StaticMethodReferenceColumn... columns); /** * Use {@code getter} method references to specify the properties of the query.
*
{@code
     * createQuery()
     * .select(user::getName)
     * .fetch()
     * }
* * @param columns The columns. * @param Type. * @return This. */ ME select(MethodReferenceColumn... columns); /** * Use a {@code getter static} method reference to specify properties that are not queried.
*
{@code
     * createQuery()
     * .selectExcludes(User::getName)
     * .fetch()
     * }
* * @param column The columns. * @param Type. * @return This. */ ME selectExcludes(StaticMethodReferenceColumn... column); /** * Use {@code getter} method references to specify properties that are not queried.
*
{@code
     * createQuery()
     * .selectExcludes(user::getName)
     * .fetch()
     * }
* * @param columns The columns. * @param Type. * @return This. */ ME selectExcludes(MethodReferenceColumn... columns); /** * Specify the pagination criteria. * * @param pageIndex Page number, starting with 0. * @param pageSize Number per page. * @return This. */ ME paging(int pageIndex, int pageSize); /** * Specify sorting, support multi-column sorting. * * @param orders The sort. * @return This. * @see SortOrder * @see SortOrder#asc(String) * @see SortOrder#desc(String) */ ME orderBy(SortOrder... orders); /** * Specify sorting, support multi-column sorting. * * @param orders The sorts. * @return This. * @see org.zodiac.fastorm.rdb.operator.dml.query.Orders#asc(String) * @see org.zodiac.fastorm.rdb.operator.dml.query.Orders#desc(String) */ ME orderBy(SortOrderSupplier... orders); /** * Directly set the dynamic query conditions, after calling this method, the conditions called by the above methods will be overwritten. * * @param param The criteria. * @return This. */ ME setParam(QueryParam param); /** *
select * from xx for update
* * @return This. */ ME forUpdate(); /** * Set the context. * * @param context The context. * @return This. */ ME context(Map context); /** * Set the context. * * @param key The key. * @param value The value. * @return This. */ ME context(String key, Object value); /** * @return Dynamic query parameter. */ QueryParam getParam(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy