AggregateBucketAutoGranularity.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /* Copyright 2016-present MongoDB Inc.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. using MongoDB.Driver.Core.Misc;
  16. namespace MongoDB.Driver
  17. {
  18. /// <summary>
  19. /// Represents the granularity value for a $bucketAuto stage.
  20. /// </summary>
  21. public struct AggregateBucketAutoGranularity
  22. {
  23. #region static
  24. /// <summary>
  25. /// Gets the E6 granularity.
  26. /// </summary>
  27. public static AggregateBucketAutoGranularity E6 => new AggregateBucketAutoGranularity("E6");
  28. /// <summary>
  29. /// Gets the E12 granularity.
  30. /// </summary>
  31. public static AggregateBucketAutoGranularity E12 => new AggregateBucketAutoGranularity("E12");
  32. /// <summary>
  33. /// Gets the E24 granularity.
  34. /// </summary>
  35. public static AggregateBucketAutoGranularity E24 => new AggregateBucketAutoGranularity("E24");
  36. /// <summary>
  37. /// Gets the E48 granularity.
  38. /// </summary>
  39. public static AggregateBucketAutoGranularity E48 => new AggregateBucketAutoGranularity("E48");
  40. /// <summary>
  41. /// Gets the E96 granularity.
  42. /// </summary>
  43. public static AggregateBucketAutoGranularity E96 => new AggregateBucketAutoGranularity("E96");
  44. /// <summary>
  45. /// Gets the E192 granularity.
  46. /// </summary>
  47. public static AggregateBucketAutoGranularity E192 => new AggregateBucketAutoGranularity("E192");
  48. /// <summary>
  49. /// Gets the POWERSOF2 granularity.
  50. /// </summary>
  51. public static AggregateBucketAutoGranularity PowersOf2 => new AggregateBucketAutoGranularity("POWERSOF2");
  52. /// <summary>
  53. /// Gets the R5 granularity.
  54. /// </summary>
  55. public static AggregateBucketAutoGranularity R5 => new AggregateBucketAutoGranularity("R5");
  56. /// <summary>
  57. /// Gets the R10 granularity.
  58. /// </summary>
  59. public static AggregateBucketAutoGranularity R10 => new AggregateBucketAutoGranularity("R10");
  60. /// <summary>
  61. /// Gets the R20 granularity.
  62. /// </summary>
  63. public static AggregateBucketAutoGranularity R20 => new AggregateBucketAutoGranularity("R20");
  64. /// <summary>
  65. /// Gets the R40 granularity.
  66. /// </summary>
  67. public static AggregateBucketAutoGranularity R40 => new AggregateBucketAutoGranularity("R40");
  68. /// <summary>
  69. /// Gets the R80 granularity.
  70. /// </summary>
  71. public static AggregateBucketAutoGranularity R80 => new AggregateBucketAutoGranularity("R80");
  72. /// <summary>
  73. /// Gets the 1-2-5 granularity.
  74. /// </summary>
  75. public static AggregateBucketAutoGranularity S1_2_5 => new AggregateBucketAutoGranularity("1-2-5");
  76. #endregion
  77. private readonly string _value;
  78. /// <summary>
  79. /// Initializes a new instance of the <see cref="AggregateBucketAutoGranularity"/> struct.
  80. /// </summary>
  81. /// <param name="value">The value.</param>
  82. public AggregateBucketAutoGranularity(string value)
  83. {
  84. _value = Ensure.IsNotNull(value, nameof(value));
  85. }
  86. /// <summary>
  87. /// Gets the value.
  88. /// </summary>
  89. public string Value => _value;
  90. }
  91. }