|
| 1 | +/* Copyright 2016 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 | + |
| 16 | +using MongoDB.Driver.Core.Misc; |
| 17 | + |
| 18 | +namespace MongoDB.Driver |
| 19 | +{ |
| 20 | + /// <summary> |
| 21 | + /// Represents the granularity value for a $bucketAuto stage. |
| 22 | + /// </summary> |
| 23 | + public struct AggregateBucketAutoGranularity |
| 24 | + { |
| 25 | + #region static |
| 26 | + /// <summary> |
| 27 | + /// Gets the E6 granularity. |
| 28 | + /// </summary> |
| 29 | + public static AggregateBucketAutoGranularity E6 => new AggregateBucketAutoGranularity("E6"); |
| 30 | + |
| 31 | + /// <summary> |
| 32 | + /// Gets the E12 granularity. |
| 33 | + /// </summary> |
| 34 | + public static AggregateBucketAutoGranularity E12 => new AggregateBucketAutoGranularity("E12"); |
| 35 | + |
| 36 | + /// <summary> |
| 37 | + /// Gets the E24 granularity. |
| 38 | + /// </summary> |
| 39 | + public static AggregateBucketAutoGranularity E24 => new AggregateBucketAutoGranularity("E24"); |
| 40 | + |
| 41 | + /// <summary> |
| 42 | + /// Gets the E48 granularity. |
| 43 | + /// </summary> |
| 44 | + public static AggregateBucketAutoGranularity E48 => new AggregateBucketAutoGranularity("E48"); |
| 45 | + |
| 46 | + /// <summary> |
| 47 | + /// Gets the E96 granularity. |
| 48 | + /// </summary> |
| 49 | + public static AggregateBucketAutoGranularity E96 => new AggregateBucketAutoGranularity("E96"); |
| 50 | + |
| 51 | + /// <summary> |
| 52 | + /// Gets the E192 granularity. |
| 53 | + /// </summary> |
| 54 | + public static AggregateBucketAutoGranularity E192 => new AggregateBucketAutoGranularity("E192"); |
| 55 | + |
| 56 | + /// <summary> |
| 57 | + /// Gets the POWERSOF2 granularity. |
| 58 | + /// </summary> |
| 59 | + public static AggregateBucketAutoGranularity PowersOf2 => new AggregateBucketAutoGranularity("POWERSOF2"); |
| 60 | + |
| 61 | + /// <summary> |
| 62 | + /// Gets the R5 granularity. |
| 63 | + /// </summary> |
| 64 | + public static AggregateBucketAutoGranularity R5 => new AggregateBucketAutoGranularity("R5"); |
| 65 | + |
| 66 | + /// <summary> |
| 67 | + /// Gets the R10 granularity. |
| 68 | + /// </summary> |
| 69 | + public static AggregateBucketAutoGranularity R10 => new AggregateBucketAutoGranularity("R10"); |
| 70 | + |
| 71 | + /// <summary> |
| 72 | + /// Gets the R20 granularity. |
| 73 | + /// </summary> |
| 74 | + public static AggregateBucketAutoGranularity R20 => new AggregateBucketAutoGranularity("R20"); |
| 75 | + |
| 76 | + /// <summary> |
| 77 | + /// Gets the R40 granularity. |
| 78 | + /// </summary> |
| 79 | + public static AggregateBucketAutoGranularity R40 => new AggregateBucketAutoGranularity("R40"); |
| 80 | + |
| 81 | + /// <summary> |
| 82 | + /// Gets the R80 granularity. |
| 83 | + /// </summary> |
| 84 | + public static AggregateBucketAutoGranularity R80 => new AggregateBucketAutoGranularity("R80"); |
| 85 | + |
| 86 | + /// <summary> |
| 87 | + /// Gets the 1-2-5 granularity. |
| 88 | + /// </summary> |
| 89 | + public static AggregateBucketAutoGranularity S1_2_5 => new AggregateBucketAutoGranularity("1-2-5"); |
| 90 | + |
| 91 | + #endregion |
| 92 | + |
| 93 | + private readonly string _value; |
| 94 | + |
| 95 | + /// <summary> |
| 96 | + /// Initializes a new instance of the <see cref="AggregateBucketAutoGranularity"/> struct. |
| 97 | + /// </summary> |
| 98 | + /// <param name="value">The value.</param> |
| 99 | + public AggregateBucketAutoGranularity(string value) |
| 100 | + { |
| 101 | + _value = Ensure.IsNotNull(value, nameof(value)); |
| 102 | + } |
| 103 | + |
| 104 | + /// <summary> |
| 105 | + /// Gets the value. |
| 106 | + /// </summary> |
| 107 | + public string Value => _value; |
| 108 | + } |
| 109 | +} |
0 commit comments