Struct LTree
Represents a PostgreSQL ltree type. This type is implicitly convertible to a .NET
Implements
Namespace: Microsoft.EntityFrameworkCore
Assembly: Npgsql.EntityFrameworkCore.PostgreSQL.dll
Syntax
public readonly struct LTree : IEquatable<LTree>
Remarks
Constructors
| Improve this Doc View SourceLTree(string)
Constructs a new instance of LTree.
Declaration
public LTree(string value)
Parameters
Type | Name | Description |
---|---|---|
string | value | The string value for the ltree. |
Remarks
Properties
| Improve this Doc View SourceNLevel
Returns number of labels in path.
Declaration
public int NLevel { get; }
Property Value
Type | Description |
---|---|
int |
Remarks
The property is translated to nlevel(ltree)
.
See https://www.postgresql.org/docs/current/ltree.html
Methods
| Improve this Doc View SourceEquals(LTree)
Declaration
public bool Equals(LTree other)
Parameters
Type | Name | Description |
---|---|---|
LTree | other |
Returns
Type | Description |
---|---|
bool |
Remarks
| Improve this Doc View SourceEquals(object?)
Declaration
public override bool Equals(object? obj)
Parameters
Type | Name | Description |
---|---|---|
object? | obj |
Returns
Type | Description |
---|---|
bool |
Remarks
| Improve this Doc View SourceGetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int |
Remarks
| Improve this Doc View SourceIndex(LTree, int)
Returns position of first occurrence of other
in this ltree, or -1 if not found.
The search starts at position offset
; negative offset means start -offset labels from the end of the path.
Declaration
public int Index(LTree other, int offset)
Parameters
Type | Name | Description |
---|---|---|
LTree | other | |
int | offset |
Returns
Type | Description |
---|---|
int |
Remarks
The method call is translated to index(ltree1, ltree2, offset)
.
See https://www.postgresql.org/docs/current/ltree.html
Index(LTree)
Returns position of first occurrence of other
in this ltree, or -1 if not found.
Declaration
public int Index(LTree other)
Parameters
Type | Name | Description |
---|---|---|
LTree | other |
Returns
Type | Description |
---|---|
int |
Remarks
The method call is translated to index(ltree1, ltree2)
.
See https://www.postgresql.org/docs/current/ltree.html
IsAncestorOf(LTree)
Returns whether this ltree is an ancestor of other
(or equal).
Declaration
public bool IsAncestorOf(LTree other)
Parameters
Type | Name | Description |
---|---|---|
LTree | other |
Returns
Type | Description |
---|---|
bool |
Remarks
The method call is translated to left @> right
.
See https://www.postgresql.org/docs/current/ltree.html
IsDescendantOf(LTree)
Returns whether this ltree is a descendant of other
(or equal).
Declaration
public bool IsDescendantOf(LTree other)
Parameters
Type | Name | Description |
---|---|---|
LTree | other |
Returns
Type | Description |
---|---|
bool |
Remarks
The method call is translated to left <@ right
.
See https://www.postgresql.org/docs/current/ltree.html
LongestCommonAncestor(params LTree[])
Computes longest common ancestor of paths.
Declaration
public static LTree LongestCommonAncestor(params LTree[] others)
Parameters
Type | Name | Description |
---|---|---|
LTree[] | others |
Returns
Type | Description |
---|---|
LTree |
Remarks
The method call is translated to lca(others)
.
See https://www.postgresql.org/docs/current/ltree.html
MatchesLQuery(string)
Returns whether this ltree matches lquery
.
Declaration
public bool MatchesLQuery(string lquery)
Parameters
Type | Name | Description |
---|---|---|
string | lquery |
Returns
Type | Description |
---|---|
bool |
Remarks
The method call is translated to left ~ right
.
See https://www.postgresql.org/docs/current/ltree.html
MatchesLTxtQuery(string)
Returns whether this ltree matches ltxtquery
.
Declaration
public bool MatchesLTxtQuery(string ltxtquery)
Parameters
Type | Name | Description |
---|---|---|
string | ltxtquery |
Returns
Type | Description |
---|---|
bool |
Remarks
The method call is translated to left @ right
.
See https://www.postgresql.org/docs/current/ltree.html
Subpath(int, int)
Returns subpath of this ltree starting at position offset
, with length len
.
If offset
is negative, subpath starts that far from the end of the path.
If len
is negative, leaves that many labels off the end of the path.
Declaration
public LTree Subpath(int offset, int len)
Parameters
Type | Name | Description |
---|---|---|
int | offset | |
int | len |
Returns
Type | Description |
---|---|
LTree |
Remarks
The method call is translated to subpath(ltree, offset, len)
.
See https://www.postgresql.org/docs/current/ltree.html
Subpath(int)
Returns subpath of ltree starting at position offset
, extending to end of path.
If offset
is negative, subpath starts that far from the end of the path.
Declaration
public LTree Subpath(int offset)
Parameters
Type | Name | Description |
---|---|---|
int | offset |
Returns
Type | Description |
---|---|
LTree |
Remarks
The method call is translated to subpath(ltree, offset)
.
See https://www.postgresql.org/docs/current/ltree.html
Subtree(int, int)
Returns subpath of this ltree from position start
to position end
-1
(counting from 0).
Declaration
public LTree Subtree(int start, int end)
Parameters
Type | Name | Description |
---|---|---|
int | start | |
int | end |
Returns
Type | Description |
---|---|
LTree |
Remarks
The method call is translated to subltree(ltree, start, end)
.
See https://www.postgresql.org/docs/current/ltree.html
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
string |
Remarks
Operators
| Improve this Doc View Sourceoperator ==(LTree, LTree)
Compares two LTree instances for equality.
Declaration
public static bool operator ==(LTree x, LTree y)
Parameters
Type | Name | Description |
---|---|---|
LTree | x | |
LTree | y |
Returns
Type | Description |
---|---|
bool |
Remarks
| Improve this Doc View Sourceimplicit operator string(LTree)
Converts a string to an LTree type.
Declaration
public static implicit operator string(LTree ltree)
Parameters
Type | Name | Description |
---|---|---|
LTree | ltree |
Returns
Type | Description |
---|---|
string |
Remarks
| Improve this Doc View Sourceimplicit operator LTree(string)
Converts an LTree type to a string.
Declaration
public static implicit operator LTree(string value)
Parameters
Type | Name | Description |
---|---|---|
string | value |
Returns
Type | Description |
---|---|
LTree |
Remarks
| Improve this Doc View Sourceoperator !=(LTree, LTree)
Compares two LTree instances for inequality.
Declaration
public static bool operator !=(LTree x, LTree y)
Parameters
Type | Name | Description |
---|---|---|
LTree | x | |
LTree | y |
Returns
Type | Description |
---|---|
bool |