core.bones.uid

Classes

UidBone

The "UidBone" represents a data field that contains text values.

Functions

generate_number(db_key)

The generate_number method generates a leading number that is always unique per entry.

generate_uid(skel, bone)

Module Contents

core.bones.uid.generate_number(db_key)

The generate_number method generates a leading number that is always unique per entry.

Parameters:

db_key (viur.core.db.Key)

Return type:

int

core.bones.uid.generate_uid(skel, bone)
class core.bones.uid.UidBone(*, generate_fn=generate_uid, fillchar='*', length=13, pattern='*', **kwargs)

Bases: viur.core.bones.base.BaseBone

The “UidBone” represents a data field that contains text values.

Initializes a new UidBone.

Parameters:
  • generate_fn (Callable) – The compute function to calculate the unique value,

  • fillchar (str)

  • length (int)

  • pattern (str | Callable | None)

:param fillchar The char that are filed in when the uid has not the length. :param length: The length allowed for values of this bone. :param pattern: The pattern for this Bone. “*” will be replaced with the uid value. :param kwargs: Inherited arguments from the BaseBone.

type = 'uid'
fillchar = ''
length = 13
pattern = ''
structure()

Describes the bone and its settings as an JSON-serializable dict. This function has to be implemented for subsequent, specialized bone types.

Return type:

dict