Min
Not available in this language yet.
Min( value_1, value_2, ... )
Min( value_1, value_2, ... )
Min( value_1, value_2, ... )
Not available in this language yet.
Min( value_1, value_2, ... )
Parameters
Argument | Type | Definition and Requirements |
---|---|---|
|
List of values |
A single value or a list of values. |
Examples
The query below executes an array of independent min operations and returns the results in an array. The result array position matches the execution array position. The top operation in the execution array, minimum of the values 1, 5, and 22, returns a long value of 1 in the top position of the result array.
Not available in this language yet.
result, err := client.Query(
f.Arr{
f.Min(1, 5, 22),
f.Min(1, 0, 3, -1),
f.Min(-1, 12, 3, -1),
f.Min(10)})
if (err != nil) {
fmt.Println(err)
} else {
fmt.Println(result)
}
}
[1 -1 -1 10]
System.out.println(
client.query(
Arr(
Min(Value(1), Value(5), Value(22)),
Min(Value(1), Value(0), Value(3), Value(-1)),
Min(Value(-1), Value(12), Value(3), Value(-1)),
Min(Value(10))
)
).get()
);
[1, -1, -1, 10]
client.query([
q.Min(1, 5, 22),
q.Min(1, 0, 3, -1),
q.Min(-1, 12, 3, -1),
q.Min(10),
])
.then((ret) => console.log(ret))
[ 1, -1, -1, 10 ]
Not available in this language yet.
println(Await.result(
client.query(
Arr(
Min(1, 5, 22),
Min(1, 0, 3, -1),
Min(-1, 12, 3, -1),
Min(10)
)
),
5.seconds
))
client.close()
}
[1, -1, -1, 10]
The following query uses the same approach as the previous query to
demonstrate using Min
with various types of values:
Not available in this language yet.
result, err := client.Query(
f.Arr{
f.Min("A", "B", "C", "D"),
f.Min(f.Time("1970-01-01T00:00:00Z"), f.Time("1980-01-01T00:00:00Z")),
f.Min(f.Date("1970-01-01"), f.Date("1930-01-01")),
f.Min("A", 1),
f.Min(true, false),
f.Min(f.Obj{"x": 10}, f.Obj{"x": 11}),
f.Min(f.Arr{"A"}, f.Arr{"B"}, f.Arr{"C"}),
f.Min(f.Arr{"X"}, f.Arr{"A", "B"})})
if (err != nil) {
fmt.Println(err)
} else {
fmt.Println(result)
}
[A {0 62135596800 <nil>} {0 60873292800 <nil>} 1 false map[x:10] [A] [A B]]
System.out.println(
client.query(
Arr(
Min(Value("A"), Value("B"), Value("C"), Value("D")),
Min(Time("1970-01-01T00:00:00Z"), Time("1980-01-01T00:00:00Z")),
Min(Date("1970-01-01"), Date("1930-01-01")),
Min(Value("A"), Value(1)),
Min(Value(true), Value(false)),
Min(Obj("x", Value(10)), Obj("x", Value(11))),
Min(Arr(Value("A")), Arr(Value("B")), Arr(Value("C"))),
Min(Arr(Value("X")), Arr(Value("A"), Value("B")))
)
).get()
);
["A", 1970-01-01T00:00:00Z, 1930-01-01, 1, false, {x: 10}, ["A"], ["A", "B"]
client.query([
q.Min('A', 'B', 'C', 'D'),
q.Min(q.Time('1970-01-01T00:00:00Z'), q.Time('1980-01-01T00:00:00Z')),
q.Min(q.Date('1970-01-01'), q.Date('1930-01-01')),
q.Min('A', 1),
q.Min(true, false),
q.Min({ x: 10 }, { x: 11 }),
q.Min(['A'], ['B'], ['C']),
q.Min(['X'], ['A', 'B']),
])
.then((ret) => console.log(ret))
[ 'A',
Time("1970-01-01T00:00:00Z"),
Date("1930-01-01"),
1,
false,
{ x: 10 },
[ 'A' ],
[ 'A', 'B' ] ]
Not available in this language yet.
println(Await.result(client.query(
Arr(
Min("A", "B", "C", "D"),
Min(Time("1970-01-01T00:00:00Z"), Time("1980-01-01T00:00:00Z")),
Min(Date("1970-01-01"), Date("1930-01-01")),
Min("A", 1),
Min(true, false),
Min(Obj("x" -> 10), Obj("x" -> 11)),
Min(Arr("A"), Arr("B"), Arr("C")),
Min(Arr("X"), Arr("A", "B"))
)
),
5.seconds))
["A", 1970-01-01T00:00:00Z, 1930-01-01, 1, false, {x: 10}, ["A"], ["A", "B"]]
Is this article helpful?
Tell Fauna how the article can be improved:
Visit Fauna's forums
or email docs@fauna.com
Thank you for your feedback!