@@ -4,10 +4,10 @@ defmodule Ecto.Adapters.SQL.Connection do
44 """
55
66 @ typedoc "The query name"
7- @ type name :: String . t
7+ @ type name :: String . t ( )
88
99 @ typedoc "The SQL statement"
10- @ type statement :: String . t
10+ @ type statement :: String . t ( )
1111
1212 @ typedoc "The cached query which is a DBConnection Query"
1313 @ type cached :: map
@@ -19,38 +19,38 @@ defmodule Ecto.Adapters.SQL.Connection do
1919 Receives options and returns `DBConnection` supervisor child
2020 specification.
2121 """
22- @ callback child_spec ( options :: Keyword . t ) :: :supervisor . child_spec ( ) | { module , Keyword . t }
22+ @ callback child_spec ( options :: Keyword . t ( ) ) :: :supervisor . child_spec ( ) | { module , Keyword . t ( ) }
2323
2424 @ doc """
2525 Prepares and executes the given query with `DBConnection`.
2626 """
27- @ callback prepare_execute ( connection , name , statement , params , options :: Keyword . t ) ::
28- { :ok , cached , term } | { :error , Exception . t }
27+ @ callback prepare_execute ( connection , name , statement , params , options :: Keyword . t ( ) ) ::
28+ { :ok , cached , term } | { :error , Exception . t ( ) }
2929
3030 @ doc """
3131 Executes a cached query.
3232 """
33- @ callback execute ( connection , cached , params , options :: Keyword . t ) ::
34- { :ok , cached , term } | { :ok , term } | { :error | :reset , Exception . t }
33+ @ callback execute ( connection , cached , params , options :: Keyword . t ( ) ) ::
34+ { :ok , cached , term } | { :ok , term } | { :error | :reset , Exception . t ( ) }
3535
3636 @ doc """
3737 Runs the given statement as a query.
3838 """
39- @ callback query ( connection , statement , params , options :: Keyword . t ) ::
40- { :ok , term } | { :error , Exception . t }
39+ @ callback query ( connection , statement , params , options :: Keyword . t ( ) ) ::
40+ { :ok , term } | { :error , Exception . t ( ) }
4141
4242 @ doc """
4343 Runs the given statement as a multi-result query.
4444 """
45- @ callback query_many ( connection , statement , params , options :: Keyword . t ) ::
46- { :ok , term } | { :error , Exception . t }
45+ @ callback query_many ( connection , statement , params , options :: Keyword . t ( ) ) ::
46+ { :ok , term } | { :error , Exception . t ( ) }
4747
4848 @ doc """
4949 Returns a stream that prepares and executes the given query with
5050 `DBConnection`.
5151 """
52- @ callback stream ( connection , statement , params , options :: Keyword . t ) ::
53- Enum . t
52+ @ callback stream ( connection , statement , params , options :: Keyword . t ( ) ) ::
53+ Enum . t ( )
5454
5555 @ doc """
5656 Receives the exception returned by `c:query/4`.
@@ -64,46 +64,60 @@ defmodule Ecto.Adapters.SQL.Connection do
6464 Must return an empty list if the error does not come
6565 from any constraint.
6666 """
67- @ callback to_constraints ( exception :: Exception . t , options :: Keyword . t ) :: Keyword . t
67+ @ callback to_constraints ( exception :: Exception . t ( ) , options :: Keyword . t ( ) ) :: Keyword . t ( )
6868
6969 ## Queries
7070
7171 @ doc """
7272 Receives a query and must return a SELECT query.
7373 """
74- @ callback all ( query :: Ecto.Query . t ) :: iodata
74+ @ callback all ( query :: Ecto.Query . t ( ) ) :: iodata
7575
7676 @ doc """
7777 Receives a query and values to update and must return an UPDATE query.
7878 """
79- @ callback update_all ( query :: Ecto.Query . t ) :: iodata
79+ @ callback update_all ( query :: Ecto.Query . t ( ) ) :: iodata
8080
8181 @ doc """
8282 Receives a query and must return a DELETE query.
8383 """
84- @ callback delete_all ( query :: Ecto.Query . t ) :: iodata
84+ @ callback delete_all ( query :: Ecto.Query . t ( ) ) :: iodata
8585
8686 @ doc """
8787 Returns an INSERT for the given `rows` in `table` returning
8888 the given `returning`.
8989 """
90- @ callback insert ( prefix :: String . t , table :: String . t ,
91- header :: [ atom ] , rows :: [ [ atom | nil ] ] ,
92- on_conflict :: Ecto.Adapter.Schema . on_conflict , returning :: [ atom ] ,
93- placeholders :: [ term ] ) :: iodata
90+ @ callback insert (
91+ prefix :: String . t ( ) ,
92+ table :: String . t ( ) ,
93+ header :: [ atom ] ,
94+ rows :: [ [ atom | nil ] ] ,
95+ on_conflict :: Ecto.Adapter.Schema . on_conflict ( ) ,
96+ returning :: [ atom ] ,
97+ placeholders :: [ term ]
98+ ) :: iodata
9499
95100 @ doc """
96101 Returns an UPDATE for the given `fields` in `table` filtered by
97102 `filters` returning the given `returning`.
98103 """
99- @ callback update ( prefix :: String . t , table :: String . t , fields :: [ atom ] ,
100- filters :: [ atom ] , returning :: [ atom ] ) :: iodata
104+ @ callback update (
105+ prefix :: String . t ( ) ,
106+ table :: String . t ( ) ,
107+ fields :: [ atom ] ,
108+ filters :: [ atom ] ,
109+ returning :: [ atom ]
110+ ) :: iodata
101111
102112 @ doc """
103113 Returns a DELETE for the `filters` returning the given `returning`.
104114 """
105- @ callback delete ( prefix :: String . t , table :: String . t ,
106- filters :: [ atom ] , returning :: [ atom ] ) :: iodata
115+ @ callback delete (
116+ prefix :: String . t ( ) ,
117+ table :: String . t ( ) ,
118+ filters :: [ atom ] ,
119+ returning :: [ atom ]
120+ ) :: iodata
107121
108122 @ doc """
109123 Executes an EXPLAIN query or similar depending on the adapter to obtains statistics of the given query.
@@ -113,23 +127,28 @@ defmodule Ecto.Adapters.SQL.Connection do
113127
114128 Must execute the explain query and return the result.
115129 """
116- @ callback explain_query ( connection , query :: String . t , params :: Keyword . t , opts :: Keyword . t ) ::
117- { :ok , term } | { :error , Exception . t }
130+ @ callback explain_query (
131+ connection ,
132+ query :: String . t ( ) ,
133+ params :: Keyword . t ( ) ,
134+ opts :: Keyword . t ( )
135+ ) ::
136+ { :ok , term } | { :error , Exception . t ( ) }
118137
119138 ## DDL
120139
121140 @ doc """
122141 Receives a DDL command and returns a query that executes it.
123142 """
124- @ callback execute_ddl ( command :: Ecto.Adapter.Migration . command ) :: String . t | [ iodata ]
143+ @ callback execute_ddl ( command :: Ecto.Adapter.Migration . command ( ) ) :: String . t ( ) | [ iodata ]
125144
126145 @ doc """
127146 Receives a query result and returns a list of logs.
128147 """
129- @ callback ddl_logs ( result :: term ) :: [ { Logger . level , Logger . message , Logger . metadata } ]
148+ @ callback ddl_logs ( result :: term ) :: [ { Logger . level ( ) , Logger . message ( ) , Logger . metadata ( ) } ]
130149
131150 @ doc """
132151 Returns a queryable to check if the given `table` exists.
133152 """
134- @ callback table_exists_query ( table :: String . t ) :: { iodata , [ term ] }
153+ @ callback table_exists_query ( table :: String . t ( ) ) :: { iodata , [ term ] }
135154end
0 commit comments