Struct LTree
- Namespace
- Microsoft.EntityFrameworkCore
- Assembly
- Npgsql.EntityFrameworkCore.PostgreSQL.dll
Represents a PostgreSQL ltree type. This type is implicitly convertible to a .NET string.
public readonly struct LTree : IEquatable<LTree>
- Implements
- Inherited Members
Remarks
Constructors
LTree(string)
Constructs a new instance of LTree.
public LTree(string value)
Parameters
value
stringThe string value for the ltree.
Properties
NLevel
Returns number of labels in path.
public int NLevel { get; }
Property Value
Remarks
The property is translated to nlevel(ltree)
.
See https://www.postgresql.org/docs/current/ltree.html
Methods
Equals(LTree)
public bool Equals(LTree other)
Parameters
other
LTree
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
obj
object
Returns
GetHashCode()
public override int GetHashCode()
Returns
Index(LTree)
Returns position of first occurrence of other
in this ltree, or -1 if not found.
public int Index(LTree other)
Parameters
other
LTree
Returns
Remarks
The method call is translated to index(ltree1, ltree2)
.
See https://www.postgresql.org/docs/current/ltree.html
Index(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.
public int Index(LTree other, int offset)
Parameters
Returns
Remarks
The method call is translated to index(ltree1, ltree2, offset)
.
See https://www.postgresql.org/docs/current/ltree.html
IsAncestorOf(LTree)
Returns whether this ltree is an ancestor of other
(or equal).
public bool IsAncestorOf(LTree other)
Parameters
other
LTree
Returns
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).
public bool IsDescendantOf(LTree other)
Parameters
other
LTree
Returns
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.
public static LTree LongestCommonAncestor(params LTree[] others)
Parameters
others
LTree[]
Returns
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
.
public bool MatchesLQuery(string lquery)
Parameters
lquery
string
Returns
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
.
public bool MatchesLTxtQuery(string ltxtquery)
Parameters
ltxtquery
string
Returns
Remarks
The method call is translated to left @ right
.
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.
public LTree Subpath(int offset)
Parameters
offset
int
Returns
Remarks
The method call is translated to subpath(ltree, offset)
.
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.
public LTree Subpath(int offset, int len)
Parameters
Returns
Remarks
The method call is translated to subpath(ltree, offset, len)
.
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).
public LTree Subtree(int start, int end)
Parameters
Returns
Remarks
The method call is translated to subltree(ltree, start, end)
.
See https://www.postgresql.org/docs/current/ltree.html
ToString()
public override string ToString()
Returns
Operators
operator ==(LTree, LTree)
Compares two LTree instances for equality.
public static bool operator ==(LTree x, LTree y)
Parameters
Returns
implicit operator string(LTree)
Converts a string to an LTree type.
public static implicit operator string(LTree ltree)
Parameters
ltree
LTree
Returns
implicit operator LTree(string)
Converts an LTree type to a string.
public static implicit operator LTree(string value)
Parameters
value
string
Returns
operator !=(LTree, LTree)
Compares two LTree instances for inequality.
public static bool operator !=(LTree x, LTree y)