Show / Hide Table of Contents

Class TsQueryHandler

A type handler for the PostgreSQL tsquery data type.

Inheritance
System.Object
NpgsqlTypeHandler
NpgsqlTypeHandler<NpgsqlTsQuery>
TsQueryHandler
Implements
INpgsqlTypeHandler<NpgsqlTsQuery>
INpgsqlTypeHandler<NpgsqlTsQueryEmpty>
INpgsqlTypeHandler<NpgsqlTsQueryLexeme>
INpgsqlTypeHandler<NpgsqlTsQueryNot>
INpgsqlTypeHandler<NpgsqlTsQueryAnd>
INpgsqlTypeHandler<NpgsqlTsQueryOr>
INpgsqlTypeHandler<NpgsqlTsQueryFollowedBy>
Inherited Members
NpgsqlTypeHandler<NpgsqlTsQuery>.Read<TAny>(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)
NpgsqlTypeHandler<NpgsqlTsQuery>.Read<TAny>(NpgsqlReadBuffer, Int32, FieldDescription)
NpgsqlTypeHandler<NpgsqlTsQuery>.ValidateAndGetLength<TAny>(TAny, NpgsqlLengthCache, NpgsqlParameter)
NpgsqlTypeHandler<NpgsqlTsQuery>.WriteWithLength<TAny>(TAny, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean)
NpgsqlTypeHandler<NpgsqlTsQuery>.ValidateObjectAndGetLength(Object, NpgsqlLengthCache, NpgsqlParameter)
NpgsqlTypeHandler<NpgsqlTsQuery>.WriteObjectWithLength(Object, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean)
NpgsqlTypeHandler<NpgsqlTsQuery>.CreateArrayHandler(PostgresArrayType)
NpgsqlTypeHandler<NpgsqlTsQuery>.CreateRangeHandler(PostgresRangeType)
NpgsqlTypeHandler.CreateConversionButNoParamException(Type)
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Npgsql.TypeHandlers.FullTextSearchHandlers
Assembly: Npgsql.dll
Syntax
public class TsQueryHandler : NpgsqlTypeHandler<NpgsqlTsQuery>, INpgsqlTypeHandler<NpgsqlTsQuery>, INpgsqlTypeHandler<NpgsqlTsQueryEmpty>, INpgsqlTypeHandler<NpgsqlTsQueryLexeme>, INpgsqlTypeHandler<NpgsqlTsQueryNot>, INpgsqlTypeHandler<NpgsqlTsQueryAnd>, INpgsqlTypeHandler<NpgsqlTsQueryOr>, INpgsqlTypeHandler<NpgsqlTsQueryFollowedBy>
Remarks

See http://www.postgresql.org/docs/current/static/datatype-textsearch.html.

The type handler API allows customizing Npgsql's behavior in powerful ways. However, although it is public, it should be considered somewhat unstable, and may change in breaking ways, including in non-major releases. Use it at your own risk.

Constructors

TsQueryHandler(PostgresType)

Declaration
public TsQueryHandler(PostgresType postgresType)
Parameters
Type Name Description
PostgresType postgresType

Methods

Read(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)

Reads a value of type TDefault with the given length from the provided buffer, using either sync or async I/O.

Declaration
public override ValueTask<NpgsqlTsQuery> Read(NpgsqlReadBuffer buf, int len, bool async, FieldDescription fieldDescription = null)
Parameters
Type Name Description
NpgsqlReadBuffer buf

The buffer from which to read.

System.Int32 len

The byte length of the value. The buffer might not contain the full length, requiring I/O to be performed.

System.Boolean async

If I/O is required to read the full length of the value, whether it should be performed synchronously or asynchronously.

FieldDescription fieldDescription

Additional PostgreSQL information about the type, such as the length in varchar(30).

Returns
Type Description
ValueTask<NpgsqlTsQuery>

The fully-read value.

Overrides
Npgsql.TypeHandling.NpgsqlTypeHandler<NpgsqlTypes.NpgsqlTsQuery>.Read(Npgsql.NpgsqlReadBuffer, System.Int32, System.Boolean, Npgsql.BackendMessages.FieldDescription)

ValidateAndGetLength(NpgsqlTsQuery, ref NpgsqlLengthCache, NpgsqlParameter)

Called to validate and get the length of a value of a generic NpgsqlParameter<T>.

Declaration
public override int ValidateAndGetLength(NpgsqlTsQuery value, ref NpgsqlLengthCache lengthCache, NpgsqlParameter parameter)
Parameters
Type Name Description
NpgsqlTsQuery value
NpgsqlLengthCache lengthCache
NpgsqlParameter parameter
Returns
Type Description
System.Int32
Overrides
Npgsql.TypeHandling.NpgsqlTypeHandler<NpgsqlTypes.NpgsqlTsQuery>.ValidateAndGetLength(NpgsqlTypes.NpgsqlTsQuery, Npgsql.NpgsqlLengthCache, Npgsql.NpgsqlParameter)

ValidateAndGetLength(NpgsqlTsQueryAnd, ref NpgsqlLengthCache, NpgsqlParameter)

Responsible for validating that a value represents a value of the correct and which can be written for PostgreSQL - if the value cannot be written for any reason, an exception should be thrown. Also returns the byte length needed to write the value.

Declaration
public int ValidateAndGetLength(NpgsqlTsQueryAnd value, ref NpgsqlLengthCache lengthCache, NpgsqlParameter parameter)
Parameters
Type Name Description
NpgsqlTsQueryAnd value
NpgsqlLengthCache lengthCache

A cache where the length calculated during the validation phase can be stored for use at the writing phase.

NpgsqlParameter parameter

The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

Returns
Type Description
System.Int32

The number of bytes required to write the value.

ValidateAndGetLength(NpgsqlTsQueryEmpty, ref NpgsqlLengthCache, NpgsqlParameter)

Responsible for validating that a value represents a value of the correct and which can be written for PostgreSQL - if the value cannot be written for any reason, an exception should be thrown. Also returns the byte length needed to write the value.

Declaration
public int ValidateAndGetLength(NpgsqlTsQueryEmpty value, ref NpgsqlLengthCache lengthCache, NpgsqlParameter parameter)
Parameters
Type Name Description
NpgsqlTsQueryEmpty value
NpgsqlLengthCache lengthCache

A cache where the length calculated during the validation phase can be stored for use at the writing phase.

NpgsqlParameter parameter

The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

Returns
Type Description
System.Int32

The number of bytes required to write the value.

ValidateAndGetLength(NpgsqlTsQueryFollowedBy, ref NpgsqlLengthCache, NpgsqlParameter)

Responsible for validating that a value represents a value of the correct and which can be written for PostgreSQL - if the value cannot be written for any reason, an exception should be thrown. Also returns the byte length needed to write the value.

Declaration
public int ValidateAndGetLength(NpgsqlTsQueryFollowedBy value, ref NpgsqlLengthCache lengthCache, NpgsqlParameter parameter)
Parameters
Type Name Description
NpgsqlTsQueryFollowedBy value
NpgsqlLengthCache lengthCache

A cache where the length calculated during the validation phase can be stored for use at the writing phase.

NpgsqlParameter parameter

The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

Returns
Type Description
System.Int32

The number of bytes required to write the value.

ValidateAndGetLength(NpgsqlTsQueryLexeme, ref NpgsqlLengthCache, NpgsqlParameter)

Responsible for validating that a value represents a value of the correct and which can be written for PostgreSQL - if the value cannot be written for any reason, an exception should be thrown. Also returns the byte length needed to write the value.

Declaration
public int ValidateAndGetLength(NpgsqlTsQueryLexeme value, ref NpgsqlLengthCache lengthCache, NpgsqlParameter parameter)
Parameters
Type Name Description
NpgsqlTsQueryLexeme value
NpgsqlLengthCache lengthCache

A cache where the length calculated during the validation phase can be stored for use at the writing phase.

NpgsqlParameter parameter

The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

Returns
Type Description
System.Int32

The number of bytes required to write the value.

ValidateAndGetLength(NpgsqlTsQueryNot, ref NpgsqlLengthCache, NpgsqlParameter)

Responsible for validating that a value represents a value of the correct and which can be written for PostgreSQL - if the value cannot be written for any reason, an exception should be thrown. Also returns the byte length needed to write the value.

Declaration
public int ValidateAndGetLength(NpgsqlTsQueryNot value, ref NpgsqlLengthCache lengthCache, NpgsqlParameter parameter)
Parameters
Type Name Description
NpgsqlTsQueryNot value
NpgsqlLengthCache lengthCache

A cache where the length calculated during the validation phase can be stored for use at the writing phase.

NpgsqlParameter parameter

The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

Returns
Type Description
System.Int32

The number of bytes required to write the value.

ValidateAndGetLength(NpgsqlTsQueryOr, ref NpgsqlLengthCache, NpgsqlParameter)

Responsible for validating that a value represents a value of the correct and which can be written for PostgreSQL - if the value cannot be written for any reason, an exception should be thrown. Also returns the byte length needed to write the value.

Declaration
public int ValidateAndGetLength(NpgsqlTsQueryOr value, ref NpgsqlLengthCache lengthCache, NpgsqlParameter parameter)
Parameters
Type Name Description
NpgsqlTsQueryOr value
NpgsqlLengthCache lengthCache

A cache where the length calculated during the validation phase can be stored for use at the writing phase.

NpgsqlParameter parameter

The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

Returns
Type Description
System.Int32

The number of bytes required to write the value.

Write(NpgsqlTsQuery, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean)

Called to write the value of a generic NpgsqlParameter<T>.

Declaration
public override Task Write(NpgsqlTsQuery query, NpgsqlWriteBuffer buf, NpgsqlLengthCache lengthCache, NpgsqlParameter parameter, bool async)
Parameters
Type Name Description
NpgsqlTsQuery query
NpgsqlWriteBuffer buf
NpgsqlLengthCache lengthCache
NpgsqlParameter parameter
System.Boolean async
Returns
Type Description
System.Threading.Tasks.Task
Overrides
Npgsql.TypeHandling.NpgsqlTypeHandler<NpgsqlTypes.NpgsqlTsQuery>.Write(NpgsqlTypes.NpgsqlTsQuery, Npgsql.NpgsqlWriteBuffer, Npgsql.NpgsqlLengthCache, Npgsql.NpgsqlParameter, System.Boolean)

Write(NpgsqlTsQueryAnd, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean)

Writes a value to the provided buffer.

Declaration
public Task Write(NpgsqlTsQueryAnd value, NpgsqlWriteBuffer buf, NpgsqlLengthCache lengthCache, NpgsqlParameter parameter, bool async)
Parameters
Type Name Description
NpgsqlTsQueryAnd value
NpgsqlWriteBuffer buf

The buffer to which to write.

NpgsqlLengthCache lengthCache

A cache where the length calculated during the validation phase can be stored for use at the writing phase.

NpgsqlParameter parameter

The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

System.Boolean async

If I/O will be necessary (i.e. the buffer is full), determines whether it will be done synchronously or asynchronously.

Returns
Type Description
System.Threading.Tasks.Task

Write(NpgsqlTsQueryEmpty, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean)

Writes a value to the provided buffer.

Declaration
public Task Write(NpgsqlTsQueryEmpty value, NpgsqlWriteBuffer buf, NpgsqlLengthCache lengthCache, NpgsqlParameter parameter, bool async)
Parameters
Type Name Description
NpgsqlTsQueryEmpty value
NpgsqlWriteBuffer buf

The buffer to which to write.

NpgsqlLengthCache lengthCache

A cache where the length calculated during the validation phase can be stored for use at the writing phase.

NpgsqlParameter parameter

The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

System.Boolean async

If I/O will be necessary (i.e. the buffer is full), determines whether it will be done synchronously or asynchronously.

Returns
Type Description
System.Threading.Tasks.Task

Write(NpgsqlTsQueryFollowedBy, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean)

Writes a value to the provided buffer.

Declaration
public Task Write(NpgsqlTsQueryFollowedBy value, NpgsqlWriteBuffer buf, NpgsqlLengthCache lengthCache, NpgsqlParameter parameter, bool async)
Parameters
Type Name Description
NpgsqlTsQueryFollowedBy value
NpgsqlWriteBuffer buf

The buffer to which to write.

NpgsqlLengthCache lengthCache

A cache where the length calculated during the validation phase can be stored for use at the writing phase.

NpgsqlParameter parameter

The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

System.Boolean async

If I/O will be necessary (i.e. the buffer is full), determines whether it will be done synchronously or asynchronously.

Returns
Type Description
System.Threading.Tasks.Task

Write(NpgsqlTsQueryLexeme, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean)

Writes a value to the provided buffer.

Declaration
public Task Write(NpgsqlTsQueryLexeme value, NpgsqlWriteBuffer buf, NpgsqlLengthCache lengthCache, NpgsqlParameter parameter, bool async)
Parameters
Type Name Description
NpgsqlTsQueryLexeme value
NpgsqlWriteBuffer buf

The buffer to which to write.

NpgsqlLengthCache lengthCache

A cache where the length calculated during the validation phase can be stored for use at the writing phase.

NpgsqlParameter parameter

The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

System.Boolean async

If I/O will be necessary (i.e. the buffer is full), determines whether it will be done synchronously or asynchronously.

Returns
Type Description
System.Threading.Tasks.Task

Write(NpgsqlTsQueryNot, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean)

Writes a value to the provided buffer.

Declaration
public Task Write(NpgsqlTsQueryNot value, NpgsqlWriteBuffer buf, NpgsqlLengthCache lengthCache, NpgsqlParameter parameter, bool async)
Parameters
Type Name Description
NpgsqlTsQueryNot value
NpgsqlWriteBuffer buf

The buffer to which to write.

NpgsqlLengthCache lengthCache

A cache where the length calculated during the validation phase can be stored for use at the writing phase.

NpgsqlParameter parameter

The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

System.Boolean async

If I/O will be necessary (i.e. the buffer is full), determines whether it will be done synchronously or asynchronously.

Returns
Type Description
System.Threading.Tasks.Task

Write(NpgsqlTsQueryOr, NpgsqlWriteBuffer, NpgsqlLengthCache, NpgsqlParameter, Boolean)

Writes a value to the provided buffer.

Declaration
public Task Write(NpgsqlTsQueryOr value, NpgsqlWriteBuffer buf, NpgsqlLengthCache lengthCache, NpgsqlParameter parameter, bool async)
Parameters
Type Name Description
NpgsqlTsQueryOr value
NpgsqlWriteBuffer buf

The buffer to which to write.

NpgsqlLengthCache lengthCache

A cache where the length calculated during the validation phase can be stored for use at the writing phase.

NpgsqlParameter parameter

The NpgsqlParameter instance where this value resides. Can be used to access additional information relevant to the write process (e.g. Size).

System.Boolean async

If I/O will be necessary (i.e. the buffer is full), determines whether it will be done synchronously or asynchronously.

Returns
Type Description
System.Threading.Tasks.Task

Explicit Interface Implementations

INpgsqlTypeHandler<NpgsqlTsQueryAnd>.Read(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)

Declaration
ValueTask<NpgsqlTsQueryAnd> INpgsqlTypeHandler<NpgsqlTsQueryAnd>.Read(NpgsqlReadBuffer buf, int len, bool async, FieldDescription fieldDescription)
Parameters
Type Name Description
NpgsqlReadBuffer buf
System.Int32 len
System.Boolean async
FieldDescription fieldDescription
Returns
Type Description
ValueTask<NpgsqlTsQueryAnd>

INpgsqlTypeHandler<NpgsqlTsQueryEmpty>.Read(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)

Declaration
ValueTask<NpgsqlTsQueryEmpty> INpgsqlTypeHandler<NpgsqlTsQueryEmpty>.Read(NpgsqlReadBuffer buf, int len, bool async, FieldDescription fieldDescription)
Parameters
Type Name Description
NpgsqlReadBuffer buf
System.Int32 len
System.Boolean async
FieldDescription fieldDescription
Returns
Type Description
ValueTask<NpgsqlTsQueryEmpty>

INpgsqlTypeHandler<NpgsqlTsQueryFollowedBy>.Read(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)

Declaration
ValueTask<NpgsqlTsQueryFollowedBy> INpgsqlTypeHandler<NpgsqlTsQueryFollowedBy>.Read(NpgsqlReadBuffer buf, int len, bool async, FieldDescription fieldDescription)
Parameters
Type Name Description
NpgsqlReadBuffer buf
System.Int32 len
System.Boolean async
FieldDescription fieldDescription
Returns
Type Description
ValueTask<NpgsqlTsQueryFollowedBy>

INpgsqlTypeHandler<NpgsqlTsQueryLexeme>.Read(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)

Declaration
ValueTask<NpgsqlTsQueryLexeme> INpgsqlTypeHandler<NpgsqlTsQueryLexeme>.Read(NpgsqlReadBuffer buf, int len, bool async, FieldDescription fieldDescription)
Parameters
Type Name Description
NpgsqlReadBuffer buf
System.Int32 len
System.Boolean async
FieldDescription fieldDescription
Returns
Type Description
ValueTask<NpgsqlTsQueryLexeme>

INpgsqlTypeHandler<NpgsqlTsQueryNot>.Read(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)

Declaration
ValueTask<NpgsqlTsQueryNot> INpgsqlTypeHandler<NpgsqlTsQueryNot>.Read(NpgsqlReadBuffer buf, int len, bool async, FieldDescription fieldDescription)
Parameters
Type Name Description
NpgsqlReadBuffer buf
System.Int32 len
System.Boolean async
FieldDescription fieldDescription
Returns
Type Description
ValueTask<NpgsqlTsQueryNot>

INpgsqlTypeHandler<NpgsqlTsQueryOr>.Read(NpgsqlReadBuffer, Int32, Boolean, FieldDescription)

Declaration
ValueTask<NpgsqlTsQueryOr> INpgsqlTypeHandler<NpgsqlTsQueryOr>.Read(NpgsqlReadBuffer buf, int len, bool async, FieldDescription fieldDescription)
Parameters
Type Name Description
NpgsqlReadBuffer buf
System.Int32 len
System.Boolean async
FieldDescription fieldDescription
Returns
Type Description
ValueTask<NpgsqlTsQueryOr>

Implements

INpgsqlTypeHandler<T>
INpgsqlTypeHandler<T>
INpgsqlTypeHandler<T>
INpgsqlTypeHandler<T>
INpgsqlTypeHandler<T>
INpgsqlTypeHandler<T>
INpgsqlTypeHandler<T>
In This Article
Back to top Generated by DocFX