AshAtproto.StrongRef
(ash_atproto v1.0.0)
Copy Markdown
Typed struct to help modeling strong references.
Example
defmodule MyApp.ReplyRef do
use Ash.TypedStruct
typed_struct do
field :root, AshAtproto.StrongRef, allow_nil?: false
field :parent, AshAtproto.StrongRef, allow_nil?: false
end
end
defmodule MyApp.BskyPost do
use Ash.Resource,
domain: MyApp.Mixtapes,
data_layer: AshAtproto.DataLayer
attributes do
attribute :rkey, :string, primary_key?: true, allow_nil?: false
attribute :repo_did, :string, primary_key?: true, allow_nil?: false
attribute :uri, :string, primary_key?: true, allow_nil?: false
attribute :cid, :string, allow_nil?: false
attribute :text, :string
attribute :reply, MyApp.Atproto.ReplyRef
end
relationships do
has_one :parent_reply, __MODULE__ do
manual AshAtproto.Relationships.ParentPost
relationship_context %{path_to_strong_ref: [:reply, :parent]}
description "The parent of this post."
end
end
end
Summary
Functions
Create a new Elixir.AshAtproto.StrongRef, or return an error