-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsqlc.yaml
More file actions
168 lines (159 loc) · 7.2 KB
/
Copy pathsqlc.yaml
File metadata and controls
168 lines (159 loc) · 7.2 KB
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
version: 2
plugins:
- name: jsonb
process:
cmd: db/bin/sqlc-gen-json
sql:
# Indexer model gen
- schema:
- 'db/migrations/indexer'
codegen:
- out: 'db/gen/indexerdb'
plugin: jsonb
options:
indent: " "
filename: 'manifest.json'
queries: 'db/queries/indexer'
engine: 'postgresql'
gen:
go:
package: 'indexerdb'
out: 'db/gen/indexerdb'
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:
# Wildcards
# Note: to override one of these wildcard entries, add a more specific entry (like some_table.id) above
- column: '*.id'
go_type: 'github.com/mutuals/go-mutuals/service/persist.DBID'
- column: '*.chain'
go_type: 'github.com/mutuals/go-mutuals/service/persist.Chain'
# 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"
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/mutuals/go-mutuals/service/persist.DBID'
- db_type: 'address'
go_type: 'github.com/mutuals/go-mutuals/service/persist.Address'
- db_type: 'role'
go_type: 'github.com/mutuals/go-mutuals/service/persist.Role'
- db_type: 'action'
go_type: 'github.com/mutuals/go-mutuals/service/persist.Action'
- db_type: 'hextokenid'
go_type: 'github.com/mutuals/go-mutuals/service/persist.HexTokenID'
- db_type: 'chain'
go_type: 'github.com/mutuals/go-mutuals/service/persist.Chain'
# 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/mutuals/go-mutuals/service/persist.WalletList"
- column: "*.user*.notification_settings"
go_type: "github.com/mutuals/go-mutuals/service/persist.UserNotificationSettings"
- column: "*.user*.featured_pool"
go_type: "*github.com/mutuals/go-mutuals/service/persist.DBID"
- column: "*.user*.pii_socials"
go_type: "github.com/mutuals/go-mutuals/service/persist.Socials"
# Socials
- column: "pii.socials_auth.provider"
go_type: "github.com/mutuals/go-mutuals/service/persist.SocialProvider"
# Wallet
- column: "wallets.wallet_type"
go_type: "github.com/mutuals/go-mutuals/service/persist.WalletType"
# Pool
- column: 'pool.status'
go_type: 'github.com/mutuals/go-mutuals/service/persist.PoolStatus'
- column: 'allocations.recipient_type'
go_type: 'github.com/mutuals/go-mutuals/service/persist.RecipientType'
- column: 'allocations.calculation_type'
go_type: 'github.com/mutuals/go-mutuals/service/persist.CalculationType'
- column: 'allocations.value'
go_type: 'github.com/mutuals/go-mutuals/service/persist.HexString'
# Events
- column: "events.resource_type_id"
go_type: "github.com/mutuals/go-mutuals/service/persist.ResourceType"
- column: "events.data"
go_type: "github.com/mutuals/go-mutuals/service/persist.EventData"
- 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"
# Notifications
- column: "notifications.data"
go_type: "github.com/mutuals/go-mutuals/service/persist.NotificationData"
# pii.AccountCreationInfo
- column: pii.account_creation_info.ip_address
go_type: "string"
# 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/mutuals/go-mutuals/service/persist.DBID"
- column: "*.*.*_id"
go_type: "github.com/mutuals/go-mutuals/service/persist.DBID"
- column: "*.*.ids"
go_type: "github.com/mutuals/go-mutuals/service/persist.DBIDList"
- column: "*.*.*_ids"
go_type: "github.com/mutuals/go-mutuals/service/persist.DBIDList"
- column: "*.*.address"
go_type: "github.com/mutuals/go-mutuals/service/persist.Address"
- column: "*.*.*_address"
go_type: "github.com/mutuals/go-mutuals/service/persist.Address"
- column: '*.*.l1_chain'
go_type: 'github.com/mutuals/go-mutuals/service/persist.L1Chain'
- column: '*.*.*_l1_chain'
go_type: 'github.com/mutuals/go-mutuals/service/persist.L1Chain'
- column: '*.*.chain'
go_type: "github.com/mutuals/go-mutuals/service/persist.Chain"
- column: '*.*.*_chain'
go_type: "github.com/mutuals/go-mutuals/service/persist.Chain"
- column: "*.*.action"
go_type: "github.com/mutuals/go-mutuals/service/persist.Action"
- column: "*.*.thumbnail_url"
go_type: "github.com/mutuals/go-mutuals/service/persist.NullString"
- column: "*.*.media_url"
go_type: "github.com/mutuals/go-mutuals/service/persist.NullString"
- column: "*.*.actions"
go_type: "github.com/mutuals/go-mutuals/service/persist.ActionList"
- column: "*.*.collection_id"
go_type: "github.com/mutuals/go-mutuals/service/persist.DBID"
- column: "*.*.role"
go_type: "github.com/mutuals/go-mutuals/service/persist.Role"
- column: "*.*.roles"
go_type: "github.com/mutuals/go-mutuals/service/persist.RoleList"
- column: "*.*.tokens_hex"
go_type: "github.com/mutuals/go-mutuals/service/persist.TokenIDList"
- column: "*.*.token_hex"
go_type: "github.com/mutuals/go-mutuals/service/persist.TokenID"
- column: '*.*.balance'
go_type: 'github.com/mutuals/go-mutuals/service/persist.HexString'
- column: "*.previews"
go_type: "github.com/mutuals/go-mutuals/service/persist.NullString"