-
Notifications
You must be signed in to change notification settings - Fork 10
/
sqlc.yaml
274 lines (246 loc) · 12.5 KB
/
sqlc.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
version: 2
plugins:
- name: jsonb
process:
cmd: db/bin/sqlc-gen-json
sql:
# Backend model gen
- schema:
- 'db/migrations/core'
- 'db/migrations/sqlc/core'
codegen:
- out: 'db/gen/coredb'
plugin: jsonb
options:
indent: " "
filename: 'manifest.json'
queries: 'db/queries/core'
engine: 'postgresql'
strict_order_by: false
gen:
go:
package: 'coredb'
out: 'db/gen/coredb'
sql_package: 'pgx/v4'
output_db_file_name: 'db_gen.go'
output_models_file_name: 'models_gen.go'
emit_json_tags: true
emit_db_tags: true
overrides:
# DB type overrides. These are typically mappings from our own custom Postgres types to our own Go types,
# which allows us to use standard ::casts to specify query parameter types.
- db_type: 'dbid'
go_type: 'github.com/mikeydub/go-gallery/service/persist.DBID'
- db_type: 'address'
go_type: 'github.com/mikeydub/go-gallery/service/persist.Address'
- db_type: 'email'
go_type: 'github.com/mikeydub/go-gallery/service/persist.Email'
- db_type: 'role'
go_type: 'github.com/mikeydub/go-gallery/service/persist.Role'
- db_type: 'action'
go_type: 'github.com/mikeydub/go-gallery/service/persist.Action'
- db_type: 'hextokenid'
go_type: 'github.com/mikeydub/go-gallery/service/persist.HexTokenID'
- db_type: 'chain'
go_type: 'github.com/mikeydub/go-gallery/service/persist.Chain'
# Column overrides are prioritized from top to bottom, so if we need to override one of the * entries (like *.id),
# the override should come _before_ the * entry
# Users (and pii.user_view)
# "*.user*" wildcards are so these mappings will also apply to the "pii.user_view" view
- column: '*.user*.wallets'
go_type: 'github.com/mikeydub/go-gallery/service/persist.WalletList'
- column: '*.user*.email_unsubscriptions'
go_type: 'github.com/mikeydub/go-gallery/service/persist.EmailUnsubscriptions'
- column: '*.user*.notification_settings'
go_type: 'github.com/mikeydub/go-gallery/service/persist.UserNotificationSettings'
- column: '*.user*.email_verified'
go_type: 'github.com/mikeydub/go-gallery/service/persist.EmailVerificationStatus'
- column: '*.user*.featured_gallery'
go_type: '*github.com/mikeydub/go-gallery/service/persist.DBID'
- column: '*.user*.pii_socials'
go_type: 'github.com/mikeydub/go-gallery/service/persist.Socials'
# Galleries
- column: 'galleries.collections'
go_type: 'github.com/mikeydub/go-gallery/service/persist.DBIDList'
# Socials
- column: 'pii.socials_auth.provider'
go_type: 'github.com/mikeydub/go-gallery/service/persist.SocialProvider'
# Collections
- column: 'collections.nfts'
go_type: 'github.com/mikeydub/go-gallery/service/persist.DBIDList'
- column: 'collections.layout'
go_type: 'github.com/mikeydub/go-gallery/service/persist.TokenLayout'
- column: 'collections.token_settings'
go_type: { 'type': 'map[persist.DBID]persist.CollectionTokenSettings' }
# Nfts
- column: 'nfts.contract'
go_type: 'github.com/mikeydub/go-gallery/service/persist.NFTContract'
# Tokens
- column: 'tokens.owned_by_wallets'
go_type: 'github.com/mikeydub/go-gallery/service/persist.DBIDList'
- column: 'tokens.quantity'
go_type: 'github.com/mikeydub/go-gallery/service/persist.HexString'
# TokenMedias
- column: 'token_medias.media'
go_type: 'github.com/mikeydub/go-gallery/service/persist.Media'
- column: 'token_medias.token_id'
go_type: 'github.com/mikeydub/go-gallery/service/persist.DecimalTokenID'
# TokenProcessingJobs
- column: 'token_processing_jobs.pipeline_metadata'
go_type: 'github.com/mikeydub/go-gallery/service/persist.PipelineMetadata'
- column: 'token_processing_jobs.token_properties'
go_type: 'github.com/mikeydub/go-gallery/service/persist.TokenProperties'
- column: 'token_processing_jobs.processing_cause'
go_type: 'github.com/mikeydub/go-gallery/service/persist.ProcessingCause'
# Membership
- column: 'membership.owners'
go_type: 'github.com/mikeydub/go-gallery/service/persist.TokenHolderList'
# Wallet
- column: 'wallets.wallet_type'
go_type: 'github.com/mikeydub/go-gallery/service/persist.WalletType'
# Follows
- column: 'follows.followee'
go_type: 'github.com/mikeydub/go-gallery/service/persist.DBID'
- column: 'follows.follower'
go_type: 'github.com/mikeydub/go-gallery/service/persist.DBID'
# Events
- column: 'events.resource_type_id'
go_type: 'github.com/mikeydub/go-gallery/service/persist.ResourceType'
- column: 'events.data'
go_type: 'github.com/mikeydub/go-gallery/service/persist.EventData'
- column: 'events.feed_window_size'
go_type: 'github.com/mikeydub/go-gallery/service/persist.NullInt'
- column: 'events.external_id'
go_type: 'database/sql.NullString'
- column: 'events.actor_id'
go_type: 'database/sql.NullString'
- column: 'events.group_id'
go_type: 'database/sql.NullString'
# Comments
- column: 'comments.reply_to'
go_type: 'github.com/mikeydub/go-gallery/service/persist.DBID'
# Feed Events
- column: 'feed_events.owner_id'
go_type: 'github.com/mikeydub/go-gallery/service/persist.DBID'
- column: 'feed_events.event_ids'
go_type: 'github.com/mikeydub/go-gallery/service/persist.DBIDList'
- column: 'feed_events.data'
go_type: 'github.com/mikeydub/go-gallery/service/persist.FeedEventData'
- column: 'feed_events.group_id'
go_type: 'database/sql.NullString'
# Feed Blocklist
- column: 'feed_blocklist.user_id'
go_type: 'github.com/mikeydub/go-gallery/service/persist.DBID'
- column: 'feed_blocklist.reason'
go_type: 'github.com/mikeydub/go-gallery/service/persist.ReportReason'
# Notifications
- column: 'notifications.data'
go_type: 'github.com/mikeydub/go-gallery/service/persist.NotificationData'
# Merch
- column: 'merch.token_id'
go_type: 'github.com/mikeydub/go-gallery/service/persist.HexTokenID'
# pii.AccountCreationInfo
- column: pii.account_creation_info.ip_address
go_type: 'string'
# Push Notification Tokens
- column: 'push_notification_tickets.ticket_id'
go_type: 'string'
# Sessions
- column: 'sessions.current_refresh_id'
go_type: 'string'
# Reprocess Jobs
- column: 'reprocess_jobs.id'
go_type: 'int'
# Profile Images
- column: 'profile_images.*source_type'
go_type: 'github.com/mikeydub/go-gallery/service/persist.ProfileImageSource'
# Token Definitions
- column: 'token_definitions.token_id'
go_type: 'github.com/mikeydub/go-gallery/service/persist.HexTokenID'
- column: 'token_definitions.fallback_media'
go_type: 'github.com/mikeydub/go-gallery/service/persist.FallbackMedia'
- column: 'token_definitions.token_type'
go_type: 'github.com/mikeydub/go-gallery/service/persist.TokenType'
- column: 'token_definitions.metadata'
go_type: 'github.com/mikeydub/go-gallery/service/persist.TokenMetadata'
# Communities
- column: 'community_creators.creator_type'
go_type: 'github.com/mikeydub/go-gallery/service/persist.CommunityCreatorType'
# Reported Posts
- column: 'reported_posts.reason'
go_type: 'github.com/mikeydub/go-gallery/service/persist.ReportReason'
# Token community memberships
- column: 'token_community_memberships.token_id'
go_type: 'github.com/mikeydub/go-gallery/service/persist.DecimalTokenID'
# Highlight mint claims
- column: 'highlight_mint_claims.highlight_collection_id'
go_type: 'string'
- column: 'highlight_mint_claims.highlight_claim_id'
go_type: 'string'
- column: 'highlight_mint_claims.minted_token_id'
go_type: 'github.com/mikeydub/go-gallery/service/persist.HexTokenID'
- column: 'highlight_mint_claims.status'
go_type: 'github.com/mikeydub/go-gallery/service/multichain/highlight.ClaimStatus'
- column: 'highlight_mint_claims.minted_token_metadata'
go_type: 'github.com/mikeydub/go-gallery/service/persist.TokenMetadata'
# Wildcards
# Note: to override one of these wildcard entries, add a more specific entry (like some_table.id) above.
# Format is schema.table.column; where *.*.<column> applies to all schemas and tables.
- column: '*.*.id'
go_type: 'github.com/mikeydub/go-gallery/service/persist.DBID'
- column: '*.*.*_id'
go_type: 'github.com/mikeydub/go-gallery/service/persist.DBID'
- column: '*.*.ids'
go_type: 'github.com/mikeydub/go-gallery/service/persist.DBIDList'
- column: '*.*.*_ids'
go_type: 'github.com/mikeydub/go-gallery/service/persist.DBIDList'
- column: '*.*.email_address'
go_type: 'github.com/mikeydub/go-gallery/service/persist.Email'
- column: '*.*.*_email_address'
go_type: 'github.com/mikeydub/go-gallery/service/persist.Email'
- column: '*.*.address'
go_type: 'github.com/mikeydub/go-gallery/service/persist.Address'
- column: '*.*.*_address'
go_type: 'github.com/mikeydub/go-gallery/service/persist.Address'
- column: '*.*.l1_chain'
go_type: 'github.com/mikeydub/go-gallery/service/persist.L1Chain'
- column: '*.*.*_l1_chain'
go_type: 'github.com/mikeydub/go-gallery/service/persist.L1Chain'
- column: '*.*.chain'
go_type: 'github.com/mikeydub/go-gallery/service/persist.Chain'
- column: '*.*.*_chain'
go_type: 'github.com/mikeydub/go-gallery/service/persist.Chain'
- column: '*.*.action'
go_type: 'github.com/mikeydub/go-gallery/service/persist.Action'
- column: '*.*.thumbnail_url'
go_type: 'github.com/mikeydub/go-gallery/service/persist.NullString'
- column: '*.*.media_url'
go_type: 'github.com/mikeydub/go-gallery/service/persist.NullString'
- column: '*.*.email_type'
go_type: 'github.com/mikeydub/go-gallery/service/persist.EmailType'
- column: '*.*.actions'
go_type: 'github.com/mikeydub/go-gallery/service/persist.ActionList'
- column: '*.*.collection_id'
go_type: 'github.com/mikeydub/go-gallery/service/persist.DBID'
- column: '*.*.role'
go_type: 'github.com/mikeydub/go-gallery/service/persist.Role'
- column: '*.*.roles'
go_type: 'github.com/mikeydub/go-gallery/service/persist.RoleList'
- column: '*.*.tokens_hex'
go_type: 'github.com/mikeydub/go-gallery/service/persist.HexTokenIDList'
- column: '*.*.token_hex'
go_type: 'github.com/mikeydub/go-gallery/service/persist.HexTokenID'
- column: '*.previews'
go_type: 'github.com/mikeydub/go-gallery/service/persist.NullString'
- column: '*.*.*socials'
go_type: 'github.com/mikeydub/go-gallery/service/persist.Socials'
- column: '*.*.pii_socials'
go_type: 'github.com/mikeydub/go-gallery/service/persist.Socials'
- column: '*.*.mentions'
go_type: 'github.com/mikeydub/go-gallery/service/persist.Mentions'
- column: '*.*.community_type'
go_type: 'github.com/mikeydub/go-gallery/service/persist.CommunityType'
- column: '*.*.*medias'
go_type: 'github.com/mikeydub/go-gallery/service/persist.MediaList'
- column: '*.*.persona'
go_type: 'github.com/mikeydub/go-gallery/service/persist.Persona'