object
sqids(Representation)
Representation- Text representation for identifiers. Possible values areatom,chars, andcodes.
Encoding and decoding of short, obfuscated, URL-safe ids from lists of non-negative integers, per the Sqids specification.
logtalk_load(sqids(loader))static, context_switching_calls
Specification: https://github.com/sqids/sqids-spec
Homepage: https://sqids.org
Default blocklist: https://github.com/sqids/sqids-blocklist (not bundled; see blocklist/1 option).
Public predicates
encode/2
Encodes a list of non-negative integers into an identifier using the default options.
staticencode(Numbers,Id)encode(+list(integer),-text) - oneNumbers is a variable or a partial list:instantiation_errorNumbers is neither a variable nor a list:type_error(list(non_negative_integer),Numbers)Number of the list Numbers is not an integer:type_error(integer,Number)Number of the list Numbers of Numbers is a negative integer:domain_error(non_negative_integer,Number)resource_error(blocklist_retries)encode/3
Encodes a list of non-negative integers into an id using the given options. Recognized options are alphabet(Atom) (an atom with at least three unique characters; default is the standard 62-character alphabet), min_length(Integer) (an integer between 0 and 255; default is 0), and blocklist(list(atom)) (words that must not occur in the generated id; default is []). If Numbers is empty, Id is unified with the empty atom regardless of the other options.
staticencode(Numbers,Id,Options)encode(+list(integer),-text,+list(compound)) - one_or_errorNumbers is a variable or a partial list:instantiation_errorNumbers is neither a variable nor a list:type_error(list(non_negative_integer),Numbers)Number of the list Numbers is not an integer:type_error(integer,Number)Number of the list Numbers of Numbers is a negative integer:domain_error(non_negative_integer,Number)Options is a variable or a partial list:instantiation_errorOptions is neither a variable nor a list:type_error(list,Options)Option of the list Options is neither a variable nor a compound term:type_error(compound,Option)Option of the list Options is a compound term but not a valid option:domain_error(option,Option)resource_error(blocklist_retries)decode/2
Decodes an identifier back into a list of non-negative integers using the default options. Equivalent to decode/3 with an empty options list. Numbers is [] if Id is the empty atom or contains a character that is not in the alphabet. Decoding does not check that Id is a canonical (minimal) encoding: ids rejected by encode/2-3 due to the blocklist still decode successfully, as do ids with extraneous minimum-length padding.
staticdecode(Id,Numbers)decode(+text,-list(integer)) - one_or_errorId is a variable:instantiation_errorId is neither a variable nor an atom:type_error(atom,Id)decode/3
Decodes an identifier back into a list of non-negative integers using the given options. The only recognized option is alphabet(Atom); it must be the same alphabet that was used to encode Id. Numbers is [] if Id is the empty atom or contains a character that is not in the alphabet.
staticdecode(Id,Numbers,Options)decode(+text,-list(integer),+list(compound)) - one_or_errorId is a variable:instantiation_errorId is neither a variable nor an atom:type_error(atom,Id)Options is a variable or a partial list:instantiation_errorOptions is neither a variable nor a list:type_error(list,Options)Option of the list Options is neither a variable nor a compound term:type_error(compound,Option)Option of the list Options is a compound term but not a valid option:domain_error(option,Option)Protected predicates
(no local declarations; see entity ancestors if any)
Private predicates
(no local declarations; see entity ancestors if any)
Operators
(none)
See also
sqids, ids(Representation,Bytes), cuid2(Representation,Size,Alphabet), ksuid(Representation,Alphabet), nanoid(Representation,Size,Alphabet), snowflakeid(Representation,EpochMilliseconds,TimeUnitMilliseconds,TimestampBits,NodeBits,SequenceBits,Node), typeid(Representation), ulid(Representation), uuid(Representation)