Init: bootstrap go module with basic framework
This commit is contained in:
23
models/alias.go
Normal file
23
models/alias.go
Normal file
@@ -0,0 +1,23 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"github.com/uptrace/bun"
|
||||
)
|
||||
|
||||
type Alias struct {
|
||||
bun.BaseModel `bun:"table:alias"`
|
||||
|
||||
Id int `bun:"id,pk,autoincrement"`
|
||||
GuildId int `bun:"guild_id,unique:text"`
|
||||
Alias string `bun:"alias,unique:text"`
|
||||
|
||||
Guild *Guild `bun:"belongs-to,join:guild_id=id"`
|
||||
Images []Image `bun:"m2m:alias_to_image,join:Alias=Image"`
|
||||
}
|
||||
|
||||
type AliasToImage struct {
|
||||
AliasId int `bun:"alias_id,pk"`
|
||||
Alias *Alias `bun:"rel:belongs-to,join:alias_id=id"`
|
||||
ImageId int `bun:"image_id,pk"`
|
||||
Image *Image `bun:"rel:belongs-to,join:image_id=id"`
|
||||
}
|
||||
14
models/autoRoleMsg.go
Normal file
14
models/autoRoleMsg.go
Normal file
@@ -0,0 +1,14 @@
|
||||
package models
|
||||
|
||||
import "github.com/uptrace/bun"
|
||||
|
||||
type AutoRoleMsg struct {
|
||||
bun.BaseModel `bun:"table:auto_role_msg"`
|
||||
|
||||
GuildId int `bun:"guild_id,pk"`
|
||||
MessageId string `bun:"message_id,pk"`
|
||||
RoleId string `bun:"role_id,notnull"`
|
||||
Emoji string `bun:"emoji"`
|
||||
|
||||
Guild *Guild `bun:"belongs-to:guild,join:guild_id=id"`
|
||||
}
|
||||
13
models/guild.go
Normal file
13
models/guild.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package models
|
||||
|
||||
import "github.com/uptrace/bun"
|
||||
|
||||
type Guild struct {
|
||||
bun.BaseModel `bun:"table:guild"`
|
||||
|
||||
Id int64 `bun:"id,pk,autoincrement"`
|
||||
DcId string `bun:"dc_id,unique"`
|
||||
Name string `bun:"name,notnull"`
|
||||
|
||||
AutoRoleLogChanId string `bun:"auto_role_log_chan_id"`
|
||||
}
|
||||
10
models/image.go
Normal file
10
models/image.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package models
|
||||
|
||||
import "github.com/uptrace/bun"
|
||||
|
||||
type Image struct {
|
||||
bun.BaseModel `bun:"table:image"`
|
||||
|
||||
Id int64 `bun:"id,pk,autoincrement"`
|
||||
Ext string `bun:"ext"`
|
||||
}
|
||||
Reference in New Issue
Block a user