View Source Memorex.Domain.Note (Memorex v0.1.0)

A Memorex.Domain.Note is a single line in a Memorex.Domain.Deck Markdown file which contains either the bidirectional or unidirectional delimitter (which are by default "⮂" and "→", respectively). The primary key of a Memorex.Domain.Note is a UUID which is a hash of the note content (together with the note category, which is the name of the Markdown file if this deck is a directory which contains multple Markdown files). Notes are flagged when the Memorex.Deck parsing starts (via mix memorex.read_notes), and any Memorex.Domain.Note which does not show up in the current parsing of the Memorex.Domain.Deck is purged (so if the Memorex.Domain.Note has been edited in the Markdown file, it will be deleted and re-created on the next reading/parsing of the Memorex.Domain.Deck).

Link to this section Summary

Functions

Used to purge notes which are "orphaned" when reading in the Markdown file; that is, they have either been deleted from the Markdown file, or else their content has been edited (which causes their UUID to change).

Link to this section Types

@type t() :: %Memorex.Domain.Note{
  __meta__: term(),
  bidirectional?: boolean(),
  cards: term(),
  category: String.t() | nil,
  content: [String.t()],
  deck: term(),
  deck_id: Memorex.Ecto.Schema.id() | nil,
  id: Memorex.Ecto.Schema.id() | nil,
  in_latest_parse?: boolean(),
  inserted_at: DateTime.t() | nil,
  updated_at: DateTime.t() | nil
}

Link to this section Functions

@spec clear_parse_flags() :: :ok
Link to this function

content_to_uuid(content, category)

View Source
@spec content_to_uuid([String.t()], String.t() | nil) :: String.t()
Link to this function

create_uuid_from_content(changeset)

View Source
@spec create_uuid_from_content(Ecto.Changeset.t()) :: Ecto.Changeset.t()
Link to this function

delete_notes_without_flag_set()

View Source
@spec delete_notes_without_flag_set() :: :ok

Used to purge notes which are "orphaned" when reading in the Markdown file; that is, they have either been deleted from the Markdown file, or else their content has been edited (which causes their UUID to change).

@spec new(Keyword.t()) :: t()
@spec set_parse_flag(t()) :: :ok
@spec sha1(String.t()) :: String.t()
@spec sha1_to_uuid(String.t()) :: String.t()