delta_trace_db.query.cause.actor

Functions

deep_collection_equals(a, b)

(en) Deep collection comparison function (equivalent to Dart's DeepCollectionEquality)

Classes

Actor(actor_type, actor_id[, ...])

(en) This class defines the information of the person who requested the database operation.

class delta_trace_db.query.cause.actor.Actor(actor_type: EnumActorType, actor_id: str, collection_permissions: Dict[str, Permission] | None = None, context: Dict[str, Any] | None = None, name: str | None = None, email: str | None = None, created_at: datetime | None = None, updated_at: datetime | None = None, last_access: datetime | None = None, last_access_day: datetime | None = None, operation_in_day: int | None = None, device_ids: List[str] | None = None)

Bases: CloneableFile

(en) This class defines the information of the person who requested the database operation.

(ja) データベースの操作をリクエストした者の情報を定義するクラスです。

Parameters:
  • actor_type (EnumActorType) – The actor type. Choose from human, ai, or system.

  • actor_id (str) – The serial id (user id) of the actor.

  • collection_permissions (Optional[Dict[str, Permission]]) – Collection-level permissions that relate only to database operations. The key is the collection name.

  • context (Optional[Dict[str, Any]]) – Additional metadata related to this actor.

  • name (Optional[str]) – The actor’s display name.

  • email (Optional[str]) – The actor’s email address.

  • created_at (Optional[datetime]) – The creation timestamp (UTC) of this actor. If null, set to now (UTC).

  • updated_at (Optional[datetime]) – The last update timestamp (UTC) of this actor. If None, set to created_at. This parameter should only be manually overridden when the values of name, email, context, or device_ids have been changed.

  • last_access (Optional[datetime]) – The timestamp (UTC) of the last database access by this actor. It will be automatically updated when calling update_access().

  • last_access_day (Optional[datetime]) – Day-based timestamp (UTC) used to track daily operation counts. Automatically updated when calling update_access().

  • operation_in_day (int, default=0) – The number of operations performed since last_access_day. After creating an Actor instance manually, call update_access() to initialize the daily operation state.

  • device_ids (Optional[List[str]]) – A list of device IDs associated with this actor. Used to identify devices used by the same user.

className = 'Actor'
clone() Actor

(en) Returns a deep copy of this object.

(ja) このオブジェクトのディープコピーを返します。

classmethod from_dict(src: Dict[str, Any]) Actor

(en) Restore this object from the dictionary.

(ja) このオブジェクトを辞書から復元します。

Parameters:

src (Dict[str, Any]) – A dictionary made with to_dict of this class.

Returns:

復元されたオブジェクト

Return type:

CloneableFile

to_dict() Dict[str, Any]

(en) Convert the object to a dictionary. The returned dictionary can only contain primitive types, null, lists or maps with only primitive elements. If you want to include other classes, the target class should inherit from this class and chain calls to_dict.

(ja) このオブジェクトを辞書に変換します。 戻り値の辞書にはプリミティブ型かプリミティブ型要素のみのリスト またはマップ等、そしてNoneのみを含められます。 それ以外のクラスを含めたい場合、対象のクラスもこのクラスを継承し、 to_dictを連鎖的に呼び出すようにしてください。

update_access(now: datetime, reset_hour: int = 5)

(en) Updates the access counter and last access date and time. Please note that updatedAt will not be updated. After creating an Actor instance, call this method to record the first access and initialize daily operation count.

(ja) アクセスカウンタや最終アクセス日時を更新します。 なお、updatedAtは更新されないことに注意してください。 Actorインスタンスを作成した後、最初のアクセスを記録し 日次操作カウントを初期化するために、このメソッドを呼んでください。

Parameters:
  • now (datetime) – Current time. If it is not UTC, it will be automatically converted to UTC.

  • reset_hour (int) – Specifies the time in UTC based on which the date and time count is updated.

Raises:

ValueError – if the reset_hour is invalid value (reset_hour < 0 || reset_hour > 23) .

version = '6'
delta_trace_db.query.cause.actor.deep_collection_equals(a: Any, b: Any) bool

(en) Deep collection comparison function (equivalent to Dart’s DeepCollectionEquality)

(ja) 深いコレクション比較用関数(Dart の DeepCollectionEquality 相当)

Parameters:
  • a (Any) – Comparison object A.

  • b (Any) – Comparison object B.