@@ -416,6 +416,7 @@ defmodule Ecto.Repo do
416416 application environment. It must return `{:ok, keyword}` with the updated
417417 list of configuration or `:ignore` (only in the `:supervisor` case).
418418 """
419+ @ doc group: "User callbacks"
419420 @ callback init ( context :: :supervisor | :runtime , config :: Keyword . t ( ) ) ::
420421 { :ok , Keyword . t ( ) } | :ignore
421422
@@ -424,6 +425,7 @@ defmodule Ecto.Repo do
424425 @ doc """
425426 Returns the adapter tied to the repository.
426427 """
428+ @ doc group: "Runtime API"
427429 @ callback __adapter__ :: Ecto.Adapter . t ( )
428430
429431 @ doc """
@@ -432,6 +434,7 @@ defmodule Ecto.Repo do
432434 If the `c:init/2` callback is implemented in the repository,
433435 it will be invoked with the first argument set to `:runtime`.
434436 """
437+ @ doc group: "Runtime API"
435438 @ callback config ( ) :: Keyword . t ( )
436439
437440 @ doc """
@@ -446,6 +449,7 @@ defmodule Ecto.Repo do
446449 See the configuration in the moduledoc for options shared between adapters,
447450 for adapter-specific configuration see the adapter's documentation.
448451 """
452+ @ doc group: "Runtime API"
449453 @ callback start_link ( opts :: Keyword . t ( ) ) ::
450454 { :ok , pid }
451455 | { :error , { :already_started , pid } }
@@ -454,6 +458,7 @@ defmodule Ecto.Repo do
454458 @ doc """
455459 Shuts down the repository.
456460 """
461+ @ doc group: "Runtime API"
457462 @ callback stop ( timeout ) :: :ok
458463
459464 @ doc """
@@ -474,6 +479,7 @@ defmodule Ecto.Repo do
474479 See the ["Shared options"](#module-shared-options) section at the module
475480 documentation for more options.
476481 """
482+ @ doc group: "Transaction API"
477483 @ callback checkout ( ( ( ) -> result ) , opts :: Keyword . t ( ) ) :: result when result: var
478484
479485 @ doc """
@@ -496,14 +502,15 @@ defmodule Ecto.Repo do
496502 end)
497503
498504 """
505+ @ doc group: "Transaction API"
499506 @ callback checked_out? ( ) :: boolean
500507
501508 @ doc """
502- Loads `data` into a struct or a map.
509+ Loads `data` into a schema or a map.
503510
504- The first argument can be a a schema module, or a
505- map (of types) and determines the return value:
506- a struct or a map, respectively.
511+ The first argument can be a a schema module or a map (of types).
512+ The first argument determines the return value: a struct or a map,
513+ respectively.
507514
508515 The second argument `data` specifies fields and values that are to be loaded.
509516 It can be a map, a keyword list, or a `{fields, values}` tuple.
@@ -540,8 +547,9 @@ defmodule Ecto.Repo do
540547 [%User{...}, ...]
541548
542549 """
550+ @ doc group: "Schema API"
543551 @ callback load (
544- module_or_map :: module | map ( ) ,
552+ schema_or_map :: module | map ( ) ,
545553 data :: map ( ) | Keyword . t ( ) | { list , list }
546554 ) :: Ecto.Schema . t ( ) | map ( )
547555
@@ -550,6 +558,7 @@ defmodule Ecto.Repo do
550558
551559 See `c:put_dynamic_repo/1` for more information.
552560 """
561+ @ doc group: "Runtime API"
553562 @ callback get_dynamic_repo ( ) :: atom ( ) | pid ( )
554563
555564 @ doc """
@@ -585,6 +594,7 @@ defmodule Ecto.Repo do
585594 **Note this feature is experimental and may be changed or removed in future
586595 releases.**
587596 """
597+ @ doc group: "Runtime API"
588598 @ callback put_dynamic_repo ( name_or_pid :: atom ( ) | pid ( ) ) :: atom ( ) | pid ( )
589599
590600 ## Ecto.Adapter.Queryable
@@ -619,6 +629,7 @@ defmodule Ecto.Repo do
619629 MyRepo.get(Post, 42, prefix: "public")
620630
621631 """
632+ @ doc group: "Query API"
622633 @ callback get ( queryable :: Ecto.Queryable . t ( ) , id :: term , opts :: Keyword . t ( ) ) ::
623634 Ecto.Schema . t ( ) | nil
624635
@@ -644,6 +655,7 @@ defmodule Ecto.Repo do
644655 MyRepo.get!(Post, 42, prefix: "public")
645656
646657 """
658+ @ doc group: "Query API"
647659 @ callback get! ( queryable :: Ecto.Queryable . t ( ) , id :: term , opts :: Keyword . t ( ) ) ::
648660 Ecto.Schema . t ( )
649661
@@ -671,6 +683,7 @@ defmodule Ecto.Repo do
671683 MyRepo.get_by(Post, [title: "My post"], prefix: "public")
672684
673685 """
686+ @ doc group: "Query API"
674687 @ callback get_by (
675688 queryable :: Ecto.Queryable . t ( ) ,
676689 clauses :: Keyword . t ( ) | map ,
@@ -702,6 +715,7 @@ defmodule Ecto.Repo do
702715 MyRepo.get_by!(Post, [title: "My post"], prefix: "public")
703716
704717 """
718+ @ doc group: "Query API"
705719 @ callback get_by! (
706720 queryable :: Ecto.Queryable . t ( ) ,
707721 clauses :: Keyword . t ( ) | map ,
@@ -726,6 +740,7 @@ defmodule Ecto.Repo do
726740 MyRepo.reload([deleted_post, post1])
727741 [nil, %Post{}]
728742 """
743+ @ doc group: "Schema API"
729744 @ callback reload (
730745 struct_or_structs :: Ecto.Schema . t ( ) | [ Ecto.Schema . t ( ) ] ,
731746 opts :: Keyword . t ( )
@@ -744,6 +759,7 @@ defmodule Ecto.Repo do
744759 MyRepo.reload!([post1, post2])
745760 [%Post{}, %Post{}]
746761 """
762+ @ doc group: "Schema API"
747763 @ callback reload! ( struct_or_structs , opts :: Keyword . t ( ) ) :: struct_or_structs
748764 when struct_or_structs: Ecto.Schema . t ( ) | [ Ecto.Schema . t ( ) ]
749765
@@ -781,6 +797,7 @@ defmodule Ecto.Repo do
781797 Repo.aggregate(Post, :count, prefix: "private")
782798
783799 """
800+ @ doc group: "Query API"
784801 @ callback aggregate (
785802 queryable :: Ecto.Queryable . t ( ) ,
786803 aggregate :: :count ,
@@ -805,6 +822,7 @@ defmodule Ecto.Repo do
805822 query = from Post, limit: 10
806823 Repo.aggregate(query, :avg, :visits)
807824 """
825+ @ doc group: "Query API"
808826 @ callback aggregate (
809827 queryable :: Ecto.Queryable . t ( ) ,
810828 aggregate :: :avg | :count | :max | :min | :sum ,
@@ -842,6 +860,7 @@ defmodule Ecto.Repo do
842860 query = from p in Post, where: p.like_count > 10
843861 Repo.exists?(query)
844862 """
863+ @ doc group: "Query API"
845864 @ callback exists? ( queryable :: Ecto.Queryable . t ( ) , opts :: Keyword . t ( ) ) :: boolean ( )
846865
847866 @ doc """
@@ -868,6 +887,7 @@ defmodule Ecto.Repo do
868887 query = from p in Post, join: c in assoc(p, :comments), where: p.id == ^post_id
869888 Repo.one(query, prefix: "private")
870889 """
890+ @ doc group: "Query API"
871891 @ callback one ( queryable :: Ecto.Queryable . t ( ) , opts :: Keyword . t ( ) ) ::
872892 Ecto.Schema . t ( ) | nil
873893
@@ -888,6 +908,7 @@ defmodule Ecto.Repo do
888908 See the ["Shared options"](#module-shared-options) section at the module
889909 documentation for more options.
890910 """
911+ @ doc group: "Query API"
891912 @ callback one! ( queryable :: Ecto.Queryable . t ( ) , opts :: Keyword . t ( ) ) ::
892913 Ecto.Schema . t ( )
893914
@@ -936,6 +957,7 @@ defmodule Ecto.Repo do
936957
937958 The query given to preload may also preload its own associations.
938959 """
960+ @ doc group: "Schema API"
939961 @ callback preload ( structs_or_struct_or_nil , preloads :: term , opts :: Keyword . t ( ) ) ::
940962 structs_or_struct_or_nil
941963 when structs_or_struct_or_nil: [ Ecto.Schema . t ( ) ] | Ecto.Schema . t ( ) | nil
@@ -975,6 +997,7 @@ defmodule Ecto.Repo do
975997 made from associations and preloads. It is not invoked for each
976998 individual join inside a query.
977999 """
1000+ @ doc group: "User callbacks"
9781001 @ callback prepare_query ( operation , query :: Ecto.Query . t ( ) , opts :: Keyword . t ( ) ) ::
9791002 { Ecto.Query . t ( ) , Keyword . t ( ) }
9801003 when operation: :all | :update_all | :delete_all | :stream | :insert_all
@@ -993,6 +1016,7 @@ defmodule Ecto.Repo do
9931016 this callback will be invoked once at the beginning, but the
9941017 options returned here will be passed to all following operations.
9951018 """
1019+ @ doc group: "User callbacks"
9961020 @ callback default_options ( operation ) :: Keyword . t ( )
9971021 when operation: :all | :insert_all | :update_all | :delete_all | :stream |
9981022 :transaction | :insert | :update | :delete | :insert_or_update
@@ -1021,6 +1045,7 @@ defmodule Ecto.Repo do
10211045 select: p.title
10221046 MyRepo.all(query)
10231047 """
1048+ @ doc group: "Query API"
10241049 @ callback all ( queryable :: Ecto.Queryable . t ( ) , opts :: Keyword . t ( ) ) :: [ Ecto.Schema . t ( ) ]
10251050
10261051 @ doc """
@@ -1057,6 +1082,7 @@ defmodule Ecto.Repo do
10571082 Enum.to_list(stream)
10581083 end)
10591084 """
1085+ @ doc group: "Query API"
10601086 @ callback stream ( queryable :: Ecto.Queryable . t ( ) , opts :: Keyword . t ( ) ) :: Enum . t ( )
10611087
10621088 @ doc """
@@ -1101,6 +1127,7 @@ defmodule Ecto.Repo do
11011127 |> MyRepo.update_all([])
11021128
11031129 """
1130+ @ doc group: "Query API"
11041131 @ callback update_all (
11051132 queryable :: Ecto.Queryable . t ( ) ,
11061133 updates :: Keyword . t ( ) ,
@@ -1130,6 +1157,7 @@ defmodule Ecto.Repo do
11301157
11311158 from(p in Post, where: p.id < 10) |> MyRepo.delete_all
11321159 """
1160+ @ doc group: "Query API"
11331161 @ callback delete_all ( queryable :: Ecto.Queryable . t ( ) , opts :: Keyword . t ( ) ) ::
11341162 { integer , nil | [ term ] }
11351163
@@ -1303,6 +1331,7 @@ defmodule Ecto.Repo do
13031331 so they are not currently compatible with MySQL
13041332
13051333 """
1334+ @ doc group: "Schema API"
13061335 @ callback insert_all (
13071336 schema_or_source :: binary | { binary , module } | module ,
13081337 entries_or_query :: [ map | [ { atom , term | Ecto.Query . t } ] ] | Ecto.Query . t ,
@@ -1474,6 +1503,7 @@ defmodule Ecto.Repo do
14741503 at the same time is not recommended, as Ecto will be unable to actually
14751504 track the proper status of the association.
14761505 """
1506+ @ doc group: "Schema API"
14771507 @ callback insert (
14781508 struct_or_changeset :: Ecto.Schema . t ( ) | Ecto.Changeset . t ( ) ,
14791509 opts :: Keyword . t ( )
@@ -1535,6 +1565,7 @@ defmodule Ecto.Repo do
15351565 {:error, changeset} -> # Something went wrong
15361566 end
15371567 """
1568+ @ doc group: "Schema API"
15381569 @ callback update ( changeset :: Ecto.Changeset . t ( ) , opts :: Keyword . t ( ) ) ::
15391570 { :ok , Ecto.Schema . t ( ) } | { :error , Ecto.Changeset . t ( ) }
15401571
@@ -1585,6 +1616,7 @@ defmodule Ecto.Repo do
15851616 {:error, changeset} -> # Something went wrong
15861617 end
15871618 """
1619+ @ doc group: "Schema API"
15881620 @ callback insert_or_update ( changeset :: Ecto.Changeset . t ( ) , opts :: Keyword . t ( ) ) ::
15891621 { :ok , Ecto.Schema . t ( ) } | { :error , Ecto.Changeset . t ( ) }
15901622
@@ -1626,6 +1658,7 @@ defmodule Ecto.Repo do
16261658 end
16271659
16281660 """
1661+ @ doc group: "Schema API"
16291662 @ callback delete (
16301663 struct_or_changeset :: Ecto.Schema . t ( ) | Ecto.Changeset . t ( ) ,
16311664 opts :: Keyword . t ( )
@@ -1634,6 +1667,7 @@ defmodule Ecto.Repo do
16341667 @ doc """
16351668 Same as `c:insert/2` but returns the struct or raises if the changeset is invalid.
16361669 """
1670+ @ doc group: "Schema API"
16371671 @ callback insert! (
16381672 struct_or_changeset :: Ecto.Schema . t ( ) | Ecto.Changeset . t ( ) ,
16391673 opts :: Keyword . t ( )
@@ -1642,19 +1676,22 @@ defmodule Ecto.Repo do
16421676 @ doc """
16431677 Same as `c:update/2` but returns the struct or raises if the changeset is invalid.
16441678 """
1679+ @ doc group: "Schema API"
16451680 @ callback update! ( changeset :: Ecto.Changeset . t ( ) , opts :: Keyword . t ( ) ) ::
16461681 Ecto.Schema . t ( )
16471682
16481683 @ doc """
16491684 Same as `c:insert_or_update/2` but returns the struct or raises if the changeset
16501685 is invalid.
16511686 """
1687+ @ doc group: "Schema API"
16521688 @ callback insert_or_update! ( changeset :: Ecto.Changeset . t ( ) , opts :: Keyword . t ( ) ) ::
16531689 Ecto.Schema . t ( )
16541690
16551691 @ doc """
16561692 Same as `c:delete/2` but returns the struct or raises if the changeset is invalid.
16571693 """
1694+ @ doc group: "Schema API"
16581695 @ callback delete! (
16591696 struct_or_changeset :: Ecto.Schema . t ( ) | Ecto.Changeset . t ( ) ,
16601697 opts :: Keyword . t ( )
@@ -1735,6 +1772,7 @@ defmodule Ecto.Repo do
17351772 |> MyRepo.transaction
17361773
17371774 """
1775+ @ doc group: "Transaction API"
17381776 @ callback transaction ( fun_or_multi :: fun | Ecto.Multi . t ( ) , opts :: Keyword . t ( ) ) ::
17391777 { :ok , any }
17401778 | { :error , any }
@@ -1762,6 +1800,7 @@ defmodule Ecto.Repo do
17621800 end)
17631801
17641802 """
1803+ @ doc group: "Transaction API"
17651804 @ callback in_transaction? ( ) :: boolean
17661805
17671806 @ doc """
@@ -1771,5 +1810,6 @@ defmodule Ecto.Repo do
17711810
17721811 Note that calling `rollback` causes the code in the transaction to stop executing.
17731812 """
1813+ @ doc group: "Transaction API"
17741814 @ callback rollback ( value :: any ) :: no_return
17751815end
0 commit comments