spring-data-redis SortParameters 源码

  • 2022-08-16
  • 浏览 (402)

spring-data-redis SortParameters 代码

文件路径:/src/main/java/org/springframework/data/redis/connection/SortParameters.java

/*
 * Copyright 2011-2022 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.springframework.data.redis.connection;

import org.springframework.lang.Nullable;

/**
 * Entity containing the parameters for the SORT operation.
 *
 * @author Costin Leau
 * @author Christoph Strobl
 */
public interface SortParameters {

	/**
	 * Sorting order.
	 */
	enum Order {
		ASC, DESC
	}

	/**
	 * Utility class wrapping the 'LIMIT' setting.
	 */
	class Range {

		private final long start;
		private final long count;

		public Range(long start, long count) {
			this.start = start;
			this.count = count;
		}

		public long getStart() {
			return start;
		}

		public long getCount() {
			return count;
		}
	}

	/**
	 * Returns the sorting order. Can be null if nothing is specified.
	 *
	 * @return sorting order. {@literal null} if not set.
	 */
	@Nullable
	Order getOrder();

	/**
	 * Indicates if the sorting is numeric (default) or alphabetical (lexicographical). Can be null if nothing is
	 * specified.
	 *
	 * @return the type of sorting. {@literal null} if not set.
	 */
	@Nullable
	Boolean isAlphabetic();

	/**
	 * Returns the pattern (if set) for sorting by external keys ({@code BY}). Can be null if nothing is specified.
	 *
	 * @return {@code BY} pattern. {@literal null} if not set.
	 */
	@Nullable
	byte[] getByPattern();

	/**
	 * Returns the pattern (if set) for retrieving external keys ({@code GET}). Can be null if nothing is specified.
	 *
	 * @return {@code GET} pattern. {@literal null} if not set.
	 */
	@Nullable
	byte[][] getGetPattern();

	/**
	 * Returns the sorting limit (range or pagination). Can be null if nothing is specified.
	 *
	 * @return sorting limit/range. {@literal null} if not set.
	 */
	@Nullable
	Range getLimit();
}

相关信息

spring-data-redis 源码目录

相关文章

spring-data-redis AbstractRedisConnection 源码

spring-data-redis BitFieldSubCommands 源码

spring-data-redis ClusterCommandExecutionFailureException 源码

spring-data-redis ClusterCommandExecutor 源码

spring-data-redis ClusterInfo 源码

spring-data-redis ClusterNodeResourceProvider 源码

spring-data-redis ClusterSlotHashUtil 源码

spring-data-redis ClusterTopology 源码

spring-data-redis ClusterTopologyProvider 源码

spring-data-redis ConnectionUtils 源码

0  赞