Struct NpgsqlCube
- Namespace
- NpgsqlTypes
- Assembly
- Npgsql.dll
Represents a PostgreSQL cube data type.
public readonly struct NpgsqlCube : IEquatable<NpgsqlCube>
- Implements
- Inherited Members
Remarks
Constructors
NpgsqlCube(NpgsqlCube, double)
Makes a new cube by adding a dimension on to an existing cube, with the same values for both endpoints of the new coordinate. This is useful for building cubes piece by piece from calculated values.
public NpgsqlCube(NpgsqlCube cube, double coord)
Parameters
cubeNpgsqlCubeThe existing cube.
coorddoubleThe coordinate to add.
NpgsqlCube(NpgsqlCube, double, double)
Makes a new cube by adding a dimension on to an existing cube. This is useful for building cubes piece by piece from calculated values.
public NpgsqlCube(NpgsqlCube cube, double lowerLeft, double upperRight)
Parameters
cubeNpgsqlCubeThe existing cube.
lowerLeftdoubleThe lower left value.
upperRightdoubleThe upper right value.
NpgsqlCube(IEnumerable<double>)
Makes a zero-volume cube using the coordinates defined by the array.
public NpgsqlCube(IEnumerable<double> coords)
Parameters
coordsIEnumerable<double>The coordinates.
NpgsqlCube(IEnumerable<double>, IEnumerable<double>)
Makes a cube with upper right and lower left coordinates as defined by the two arrays, which must be of the same length.
public NpgsqlCube(IEnumerable<double> lowerLeft, IEnumerable<double> upperRight)
Parameters
lowerLeftIEnumerable<double>The lower left values.
upperRightIEnumerable<double>The upper right values.
Exceptions
- ArgumentException
Thrown if the number of dimensions in the upper left and lower right values do not match or if the cube exceeds the maximum dimensions (100).
NpgsqlCube(double)
Makes a one dimensional cube with both coordinates the same.
public NpgsqlCube(double coord)
Parameters
coorddoubleThe point coordinate.
NpgsqlCube(double, double)
Makes a one dimensional cube.
public NpgsqlCube(double lowerLeft, double upperRight)
Parameters
Properties
Dimensions
The number of dimensions of the cube.
public int Dimensions { get; }
Property Value
IsPoint
True if the cube is a point, that is, the two defining corners are the same.
public bool IsPoint { get; }
Property Value
LowerLeft
The lower left coordinates of the cube.
public IReadOnlyList<double> LowerLeft { get; }
Property Value
UpperRight
The upper right coordinates of the cube.
public IReadOnlyList<double> UpperRight { get; }
Property Value
Methods
Equals(NpgsqlCube)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(NpgsqlCube other)
Parameters
otherNpgsqlCubeAn object to compare with this object.
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand this instance are the same type and represent the same value; otherwise, false.
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
ToString()
Writes the cube in PostgreSQL's text format.
public override string ToString()
Returns
ToSubset(params int[])
Makes a new cube from an existing cube, using a list of dimension indexes from an array. Can be used to extract the endpoints of a single dimension, or to drop dimensions, or to reorder them as desired.
public NpgsqlCube ToSubset(params int[] indexes)
Parameters
indexesint[]The list of dimension indexes.
Returns
- NpgsqlCube
A new cube.
Examples
var cube = new NpgsqlCube(new[] { 1, 3, 5 }, new[] { 6, 7, 8 }); // '(1,3,5),(6,7,8)'
cube.ToSubset(1); // '(3),(7)'
cube.ToSubset(2, 1, 0, 0); // '(5,3,1,1),(8,7,6,6)'
Operators
operator ==(NpgsqlCube, NpgsqlCube)
Defines a generalized method that a value type or class implements to create a type-specific method for determining equality of instances.
public static bool operator ==(NpgsqlCube x, NpgsqlCube y)
Parameters
xNpgsqlCubeyNpgsqlCube
Returns
operator !=(NpgsqlCube, NpgsqlCube)
Defines a generalized method that a value type or class implements to create a type-specific method for determining equality of instances.
public static bool operator !=(NpgsqlCube x, NpgsqlCube y)
Parameters
xNpgsqlCubeyNpgsqlCube