FQL v4 will be decommissioned on June 30, 2025. Ensure that you complete your migration from FQL v4 to FQL v10 by that date. For more details, review the migration guide. Contact support@fauna.com with any questions. |
IsToken
This reference topic applies to FQL v4. Go to this page for the latest FQL v10 reference topics. |
IsToken( value )
is_token( value )
IsToken( value )
IsToken( value )
IsToken( value )
Parameters
Parameter | Type | Definition and Requirements |
---|---|---|
|
Any |
Any value, which is to be tested to determine whether it is a token or not. |
Examples
The following query uses Map
to iterate over an array of all of
the types of values that can be tested by a type-check function, passing
each item into a Lambda
function that returns an object, which
contains the value and the result of calling IsToken
with that
value:
[
{ value: [ 'array' ], IsToken: false },
{ value: true, IsToken: false },
{ value: false, IsToken: false },
{ value: Bytes("AQIDBA=="), IsToken: false },
{ value: [ 1, 2, 3, 4 ], IsToken: false },
{ value: Collection("Letters"), IsToken: false },
{ value: Ref(Credentials(), "268286271391007232"), IsToken: false },
{ value: Database("child_db"), IsToken: false },
{ value: Date("2019-11-12"), IsToken: false },
{ value: Ref(Collection("Letters"), "123"), IsToken: false },
{ value: 10.1, IsToken: false },
{ value: Function("double"), IsToken: false },
{ value: Index("letters"), IsToken: false },
{ value: 10, IsToken: false },
{ value: Ref(Keys(), "1"), IsToken: false },
{ value: Query(Lambda("x", Var("x"))), IsToken: false },
{ value: null, IsToken: false },
{ value: { x: 10 }, IsToken: false },
{ value: Role("employees"), IsToken: false },
{ value: Match(Index("letters")), IsToken: false },
{ value: 'ten', IsToken: false },
{ value: '10', IsToken: false },
{ value: Time("2020-06-14T06:36:17.632Z"), IsToken: false },
{ value: Ref(Tokens(), "1"), IsToken: true }
]
[{'value': ['array'], 'IsToken': False}, {'value': True, 'IsToken': False}, {'value': False, 'IsToken': False}, {'value': bytearray(b'\x01\x02\x03\x04'), 'IsToken': False}, {'value': [1, 2, 3, 4], 'IsToken': False}, {'value': Ref(id=Letters, collection=Ref(id=collections)), 'IsToken': False}, {'value': Ref(id=282032258185953792, collection=Ref(id=credentials)), 'IsToken': False}, {'value': Ref(id=child_db, collection=Ref(id=databases)), 'IsToken': False}, {'value': datetime.date(2019, 11, 12), 'IsToken': False}, {'value': Ref(id=123, collection=Ref(id=Letters, collection=Ref(id=collections))), 'IsToken': False}, {'value': 10.1, 'IsToken': False}, {'value': Ref(id=double, collection=Ref(id=functions)), 'IsToken': False}, {'value': Ref(id=letters, collection=Ref(id=indexes)), 'IsToken': False}, {'value': 10, 'IsToken': False}, {'value': Ref(id=1, collection=Ref(id=keys)), 'IsToken': False}, {'value': Query({'api_version': '4', 'lambda': 'x', 'expr': {'var': 'x'}}), 'IsToken': False}, {'value': None, 'IsToken': False}, {'value': {'x': 10}, 'IsToken': False}, {'value': Ref(id=employees, collection=Ref(id=roles)), 'IsToken': False}, {'value': SetRef({'match': Ref(id=letters, collection=Ref(id=indexes))}), 'IsToken': False}, {'value': 'ten', 'IsToken': False}, {'value': '10', 'IsToken': False}, {'value': FaunaTime('2020-07-06T12:34:56.789Z'), 'IsToken': False}, {'value': Ref(id=1, collection=Ref(id=tokens)), 'IsToken': True}]
[map[IsToken:false value:[array]] map[IsToken:false value:true] map[IsToken:false value:false] map[IsToken:false value:[1 2 3 4]] map[IsToken:false value:[1 2 3 4]] map[IsToken:false value:{Letters 0xc000122210 0xc000122210 <nil>}] map[IsToken:false value:{280481857410171392 0xc000122330 0xc000122330 <nil>}] map[IsToken:false value:{child_db 0xc000122450 0xc000122450 <nil>}] map[IsToken:false value:{0 63709113600 <nil>}] map[IsToken:false value:{123 0xc000122720 0xc000122720 <nil>}] map[IsToken:false value:10.1] map[IsToken:false value:{double 0xc000122870 0xc000122870 <nil>}] map[IsToken:false value:{letters 0xc000122990 0xc000122990 <nil>}] map[IsToken:false value:10] map[IsToken:false value:{1 0xc000122ae0 0xc000122ae0 <nil>}] map[IsToken:false value:{[123 34 97 112 105 95 118 101 114 115 105 111 110 34 58 34 51 34 44 34 108 97 109 98 100 97 34 58 34 120 34 44 34 101 120 112 114 34 58 123 34 118 97 114 34 58 34 120 34 125 125]}] map[IsToken:false value:{}] map[IsToken:false value:{}] map[IsToken:false value:map[x:10]] map[IsToken:false value:{employees 0xc000122cf0 0xc000122cf0 <nil>}] map[IsToken:false value:{map[match:{letters 0xc000122e40 0xc000122e40 <nil>}]}] map[IsToken:false value:ten] map[IsToken:false value:10] map[IsToken:false value:{789000000 63729635696 <nil>}] map[IsToken:true value:{1 0xc000122ff0 0xc000122ff0 <nil>}]]
Arr(ObjectV(value: Arr(StringV(array)),IsToken: BooleanV(False)), ObjectV(value: BooleanV(True),IsToken: BooleanV(False)), ObjectV(value: BooleanV(False),IsToken: BooleanV(False)), ObjectV(value: BytesV(0x01, 0x02, 0x03, 0x04),IsToken: BooleanV(False)), ObjectV(value: Arr(LongV(1), LongV(2), LongV(3), LongV(4)),IsToken: BooleanV(False)), ObjectV(value: RefV(id = "Letters", collection = RefV(id = "collections")),IsToken: BooleanV(False)), ObjectV(value: RefV(id = "295431978018144768", collection = RefV(id = "credentials")),IsToken: BooleanV(False)), ObjectV(value: RefV(id = "child_db", collection = RefV(id = "databases")),IsToken: BooleanV(False)), ObjectV(value: FaunaDate(2019-11-12 12:00:00 AM),IsToken: BooleanV(False)), ObjectV(value: RefV(id = "123", collection = RefV(id = "Letters", collection = RefV(id = "collections"))),IsToken: BooleanV(False)), ObjectV(value: DoubleV(10.1),IsToken: BooleanV(False)), ObjectV(value: RefV(id = "double", collection = RefV(id = "functions")),IsToken: BooleanV(False)), ObjectV(value: RefV(id = "letters", collection = RefV(id = "indexes")),IsToken: BooleanV(False)), ObjectV(value: LongV(10),IsToken: BooleanV(False)), ObjectV(value: RefV(id = "1", collection = RefV(id = "keys")),IsToken: BooleanV(False)), ObjectV(value: QueryV(System.Collections.Generic.Dictionary`2[System.String,FaunaDB.Query.Expr]),IsToken: BooleanV(False)), ObjectV(value: NullV,IsToken: BooleanV(False)), ObjectV(value: ObjectV(x: LongV(10)),IsToken: BooleanV(False)), ObjectV(value: RefV(id = "employees", collection = RefV(id = "roles")),IsToken: BooleanV(False)), ObjectV(value: SetRefV(System.Collections.Generic.Dictionary`2[System.String,FaunaDB.Types.Value]),IsToken: BooleanV(False)), ObjectV(value: StringV(ten),IsToken: BooleanV(False)), ObjectV(value: StringV(10),IsToken: BooleanV(False)), ObjectV(value: FaunaTime(2020-07-06T12:34:56.789Z),IsToken: BooleanV(False)), ObjectV(value: RefV(id = "1", collection = RefV(id = "tokens")),IsToken: BooleanV(True)))
[
{ value: [ 'array' ], IsToken: false },
{ value: true, IsToken: false },
{ value: false, IsToken: false },
{ value: { '0': 1, '1': 2, '2': 3, '3': 4 }, IsToken: false },
{ value: [ 1, 2, 3, 4 ], IsToken: false },
{ value: Collection("Letters"), IsToken: false },
{ value: Ref(Credentials(), "302043979982045696"), IsToken: false },
{ value: Database("child_db"), IsToken: false },
{ value: Date("2019-11-12"), IsToken: false },
{ value: Ref(Collection("Letters"), "123"), IsToken: false },
{ value: 10.1, IsToken: false },
{ value: Function("double"), IsToken: false },
{ value: Index("letters"), IsToken: false },
{ value: 10, IsToken: false },
{ value: Ref(Keys(), "1"), IsToken: false },
{ value: Query(Lambda("x", Var("x"))), IsToken: false },
{ value: null, IsToken: false },
{ value: { x: 10 }, IsToken: false },
{ value: Role("employees"), IsToken: false },
{ value: Match(Index("letters")), IsToken: false },
{ value: 'ten', IsToken: false },
{ value: '10', IsToken: false },
{ value: Time("2020-07-06T12:34:56.789Z"), IsToken: false },
{ value: Ref(Tokens(), "1"), IsToken: true }
]
This query operates on a pre-existing schema, which is not provided here. Also, the query is executed via a client connection, that uses a secret
acquired by calling the |
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!