initial commit on github

This commit is contained in:
2021-05-02 16:04:45 +03:00
commit 7babade475
37 changed files with 3271 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
package v1
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
}