migration to chi

This commit is contained in:
2025-03-12 16:30:40 +03:00
parent ae81fbcce9
commit 45bb32e7a6
46 changed files with 1352 additions and 1323 deletions
+23
View File
@@ -0,0 +1,23 @@
package database
type Group struct {
ID uint8 `json:"id"`
Name string `json:"name"`
Color string `json:"color"`
MaxAvatarSize int `json:"max_avatar_size" db:"max_ava_size"`
MaxAvaWeight int64 `json:"max_avatar_weight" db:"max_ava_weight"`
IsSuperuser bool `json:"is_superuser" db:"is_superuser"`
Permissions string `json:"permissions"`
}
func GetGroups() ([]*Group, error) {
var groups = make([]*Group, 0)
err := Database.Select(&groups, "select * from groups;")
return groups, err
}
func GetGroup(id int) (*Group, error) {
var group = &Group{}
err := Database.Get(group, "select * from groups where id=$1;", id)
return group, err
}