Max
Not available in this language yet.
Max( value_1, value_2, ... )
Max( value_1, value_2, ... )
Max( value_1, value_2, ... )
Not available in this language yet.
Not available in this language yet.
Not available in this language yet.
Max( 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 max operations and returns the results in an array. The result array position matches the execution array position. The top operation in the execution array, max of the values 1, 5, and 22, returns a long value of 22 in the top position of the result array.
System.out.println(
client.query(
Arr(
Max(Value(1), Value(5), Value(22)),
Max(Value(1), Value(0), Value(3), Value(-1)),
Max(Value(-1), Value(12), Value(3), Value(-1)),
Max(Value(10))
)
).get()
);
client.query([
q.Max(1, 5, 22),
q.Max(1, 0, 3, -1),
q.Max(-1, 12, 3, -1),
q.Max(10),
]).then((ret) => console.log(ret))
result, err := client.Query(
f.Arr{
f.Max(1, 5, 22),
f.Max(1, 0, 3, -1),
f.Max(-1, 12, 3, -1),
f.Max(10)})
println(Await.result(
client.query(
Arr(
Max(1, 5, 22),
Max(1, 0, 3, -1),
Max(-1, 12, 3, -1),
Max(10)
)
),
5.seconds
))
[
22,
3,
12,
10
]
[ 22, 3, 12, 10 ]
[22 3 12 10]
[22, 3, 12, 10]
The following query uses the same approach as the previous query to
demonstrate using Max
with various types of values:
System.out.println(
client.query(
Arr(
Max(Value("A"), Value("B"), Value("C"), Value("D")),
Max(Time("1970-01-01T00:00:00Z"), Time("1980-01-01T00:00:00Z")),
Max(Date("1970-01-01"), Date("1930-01-01")),
Max(Value("A"), Value(1)),
Max(Value(true), Value(false)),
Max(Obj("x", Value(10)), Obj("x", Value(11))),
Max(Arr(Value("A")), Arr(Value("B")), Arr(Value("C"))),
Max(Arr(Value("X")), Arr(Value("A"), Value("B")))
)
).get()
);
client.query([
q.Max('A', 'B', 'C', 'D'),
q.Max(q.Time('1970-01-01T00:00:00Z'), q.Time('1980-01-01T00:00:00Z')),
q.Max(q.Date('1970-01-01'), q.Date('1930-01-01')),
q.Max('A', 1),
q.Max(true, false),
q.Max({ x: 10 }, { x: 11 }),
q.Max(['A'], ['B'], ['C']),
q.Max(['X'], ['A', 'B']),
])
.then((ret) => console.log(ret))
result, err := client.Query(
f.Arr{
f.Max("A", "B", "C", "D"),
f.Max(f.Time("1970-01-01T00:00:00Z"), f.Time("1980-01-01T00:00:00Z")),
f.Max(f.Date("1970-01-01"), f.Date("1930-01-01")),
f.Max("A", 1),
f.Max(true, false),
f.Max(f.Obj{"x": 10}, f.Obj{"x": 11}),
f.Max(f.Arr{"A"}, f.Arr{"B"}, f.Arr{"C"}),
f.Max(f.Arr{"X"}, f.Arr{"A", "B"})})
println(Await.result(client.query(
Arr(
Max("A", "B", "C", "D"),
Max(Time("1970-01-01T00:00:00Z"), Time("1980-01-01T00:00:00Z")),
Max(Date("1970-01-01"), Date("1930-01-01")),
Max("A", 1),
Max(true, false),
Max(Obj("x" -> 10), Obj("x" -> 11)),
Max(Arr("A"), Arr("B"), Arr("C")),
Max(Arr("X"), Arr("A", "B"))
)
),
5.seconds))
["D", 1980-01-01T00:00:00Z, 1970-01-01, "A", true, {x: 11}, ["C"], ["X"]]
[ 'D',
Time("1980-01-01T00:00:00Z"),
Date("1970-01-01"),
'A',
true,
{ x: 11 },
[ 'C' ],
[ 'X' ] ]
[D {0 62451129600 <nil>} {0 62135596800 <nil>} A true map[x:11] [C] [X]]
["D", 1980-01-01T00:00:00Z, 1970-01-01, "A", true, {x: 11}, ["C"], ["X"]]
Was this article helpful?
We're sorry to hear that.
Tell us how we can improve!
documentation@fauna.com
Thank you for your feedback!