Commit d2814c1
* Add Options parameter to soft delete functions (#187)
- Adds optional opts parameter to soft_delete/2, soft_deleteand soft_delete_all/2
- Added tests to cover the new functionality
- Maintaions backward compatibility with existing code
- Enables use of options like 'prefix' for multi-tenant databases
- Updates function documentation with examples showing options usage
- Adds section to README about using options with soft delete functions
* Fix documentation references to maintain callback compatibility
* Add test for log option in soft_delete_all function (#187)
- Adds test to verify that log option is properly passed to Ecto
- Imported ExUnit.CaptureLog in test module to capture all log output generated within the function passed to it. Returns output as a string to assert against
- Confirms SQL queries are loggged when log: :info is passed
- Removed unnecessary comments
- Further validates that all Ecto options are correctly handled
* Simplify soft delete functions (#187)
- Remove unnecessary case statements and vars in soft_delete functions
- Pass options directly to underlying Ecto functions
- Kept same functionality while better following Elixir style conventions, and improving readability
* Refactor soft delete functions with pipe operator (#188)
- Replace varialbe assignment with pipe operators in soft_delete functions
---------
Co-authored-by: Daniel <[email protected]>
1 parent 686fe5c commit d2814c1
File tree
3 files changed
+99
-12
lines changed- lib/ecto
- test
3 files changed
+99
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
120 | 131 | | |
121 | 132 | | |
122 | 133 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
24 | 28 | | |
25 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
26 | 33 | | |
27 | | - | |
| 34 | + | |
| 35 | + | |
28 | 36 | | |
29 | 37 | | |
30 | 38 | | |
| |||
33 | 41 | | |
34 | 42 | | |
35 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
36 | 48 | | |
37 | 49 | | |
38 | 50 | | |
| |||
41 | 53 | | |
42 | 54 | | |
43 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
44 | 59 | | |
45 | | - | |
46 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
47 | 64 | | |
48 | 65 | | |
49 | | - | |
| 66 | + | |
50 | 67 | | |
51 | | - | |
52 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
53 | 72 | | |
54 | 73 | | |
55 | 74 | | |
56 | 75 | | |
57 | 76 | | |
58 | 77 | | |
59 | | - | |
60 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
61 | 81 | | |
62 | 82 | | |
63 | | - | |
| 83 | + | |
| 84 | + | |
64 | 85 | | |
65 | 86 | | |
66 | | - | |
| 87 | + | |
67 | 88 | | |
68 | 89 | | |
69 | | - | |
| 90 | + | |
70 | 91 | | |
71 | 92 | | |
72 | | - | |
| 93 | + | |
73 | 94 | | |
74 | 95 | | |
75 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
58 | 71 | | |
59 | 72 | | |
60 | 73 | | |
| |||
75 | 88 | | |
76 | 89 | | |
77 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
78 | 103 | | |
79 | 104 | | |
80 | 105 | | |
| |||
100 | 125 | | |
101 | 126 | | |
102 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
103 | 158 | | |
104 | 159 | | |
105 | 160 | | |
| |||
0 commit comments