phpcassandratimeuuid

Cassandra PHP - check if given timeuuid string is a valid timeuuid


How can I check if a given timeuuid i.e. fa6e9e80-299c-11e7-98d8-f7a8744353f3 is a valid timeuuid before query?

using a slighty different, yet still right format timeuuid: fa6e9e80-299c-11e7-98d8-f7a8744353av results in an error:

object(Cassandra\Exception\InvalidSyntaxException)#199 (7) { ["message":protected]=> string(54) "line 1:103 mismatched character 'v' expecting set null"

Cassandra PHP driver documentation does not seem to offer a valid function to check. ( https://datastax.github.io/php-driver/api/Cassandra/ )


Solution

  • Check the version of the uuid using version() method. if 1 then it's timeuuid.

    https://datastax.github.io/php-driver/api/Cassandra/interface.UuidInterface/#method-version