# Lead

class Lead<T>(val expr: ExpressionWithColumnType<T>, val offset: ExpressionWithColumnType<Int> = intLiteral(1), val defaultValue: ExpressionWithColumnType<T>? = null) : WindowFunction<T?>

Represents an SQL function that returns value evaluated at the row that is offset rows after the current row within the partition; if there is no such row, instead returns defaultValue.

## Constructors

Lead
Link copied to clipboard
constructor(expr: ExpressionWithColumnType<T>, offset: ExpressionWithColumnType<Int> = intLiteral(1), defaultValue: ExpressionWithColumnType<T>? = null)

## Properties

defaultValue
Link copied to clipboard
val defaultValue: ExpressionWithColumnType<T>?

Returns value that is used if no row found at such offset.

expr
Link copied to clipboard
val expr: ExpressionWithColumnType<T>

Returns the expression from which the rows are counted.

offset
Link copied to clipboard
val offset: ExpressionWithColumnType<Int>

Returns number of rows before the current row.

## Functions

over
Link copied to clipboard
open override fun over(): WindowFunctionDefinition<T?>

Returns window function definition.

toQueryBuilder
Link copied to clipboard
open override fun toQueryBuilder(queryBuilder: QueryBuilder)

Appends the SQL representation of this function to the specified queryBuilder.