Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
KSZK
DevTeam
becskasszasch
Commits
5f018562
Commit
5f018562
authored
Aug 25, 2021
by
fodorpatrik2000
👻
Browse files
structs for payout
parent
6f7cb8d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
db/db.go
View file @
5f018562
...
...
@@ -53,6 +53,27 @@ type Session struct {
User
*
User
`pg:"rel:has-one,join_fk:user_schacc"`
}
type
Payout
struct
{
Id
string
`pg:"id,pk,default:gen_random_uuid()"`
ProdGroupID
string
`pg:"product_group_id"`
Amount
int64
`pg:"amount"`
Date
time
.
Time
`pg:"date,default:now()"`
ProductGroup
*
ProductGroup
`pg:"rel:has-one,join_fk:product_group_id"`
}
type
ProductGroup
struct
{
Id
string
`pg:"id,pk,default:gen_random_uuid()"`
Name
string
`pg:"name"`
}
type
ProductCategories
struct
{
Id
string
`pg:"id,pk,default:gen_random_uuid()"`
ProdID
string
`pg:"product_id"`
ProdGroupID
string
`pg:"product_group_id"`
Product
*
Product
`pg:"rel:has-one,join_fk:product_id"`
ProductGroup
*
ProductGroup
`pg:"rel:has-one,join_fk:product_group_id"`
}
var
db
=
pg
.
Connect
(
&
pg
.
Options
{
Addr
:
func
()
string
{
host
:=
env
.
String
(
"POSTGRES"
,
"localhost"
)
...
...
@@ -78,6 +99,9 @@ func init() {
(
*
User
)(
nil
),
(
*
Spend
)(
nil
),
(
*
Session
)(
nil
),
(
*
ProductGroup
)(
nil
),
(
*
ProductCategories
)(
nil
),
(
*
Payout
)(
nil
),
}
for
_
,
model
:=
range
models
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment