entities

package
v0.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2024 License: GPL-3.0 Imports: 1 Imported by: 2

Documentation

Index

Constants

View Source
const TEXT_CHANNEL = 0

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel added in v0.0.10

type Channel struct {
	Entity
	Name             string
	Type             uint8          `gorm:"not null"`
	Permissions      PermissionMask `gorm:"foreignKey:FkPermissionMask"`
	Directory        Directory      `gorm:"foreignKey:FkDirectory"`
	FkPermissionMask uint
	FkDirectory      uint
}

func NewChannel added in v0.0.10

func NewChannel(name string, t uint8, fkPermission uint, fkDirectory uint) *Channel

type Directory added in v0.0.10

type Directory struct {
	Entity
	Name             string
	ParentId         *uint          `gorm:"not null"`
	Permissions      PermissionMask `gorm:"foreignKey:FkPermissionMask"`
	FkPermissionMask uint
}

func NewDirectory added in v0.0.10

func NewDirectory(name string, parentId uint, fkPerm uint) *Directory

type Entity added in v0.0.9

type Entity struct {
	ID        uint `gorm:"primaryKey"`
	CreatedAt time.Time
	UpdatedAt time.Time
}

type MessageVote added in v0.0.10

type MessageVote struct {
	Entity
	IsPositive bool    `gorm:"not null;default:0"`
	MessageId  uint    `gorm:"not null"`
	Channel    Channel `gorm:"foreignKey:FkChannel"`
	User       User    `gorm:"foreignKey:FkUser"`
	FkChannel  uint
	FkUser     uint
}

func NewMessageVote added in v0.0.10

func NewMessageVote(isPositive bool, messageId uint, fkChannel uint, fkUser uint) *MessageVote

type PermissionMask added in v0.0.10

type PermissionMask struct {
	Entity
	CanSendMessage *bool `gorm:"default:null"`
}

func NewPermissionMask added in v0.0.10

func NewPermissionMask(
	canSendMessage bool,
) *PermissionMask

type Role added in v0.0.10

type Role struct {
	Entity
	Name             string         `gorm:"uniqueIndex"`
	Color            uint32         `gorm:"default:0"`
	IconURI          *string        `gorm:"size:255"`
	Permissions      PermissionMask `gorm:"foreignKey:FkPermissionMask"`
	FkPermissionMask uint
}

func NewRole added in v0.0.10

func NewRole(name string, color uint32, iconURI string, fkPermission uint) *Role

type Server

type Server struct {
	Entity
	Name        string  `gorm:"not null;uniqueIndex"`
	Description string  `gorm:"type:text;not null"`
	Rules       string  `gorm:"type:text;not null"`
	IconURI     *string `gorm:"size:255"`
	BannerURI   *string `gorm:"size:255"`
	OwnerId     uint    `gorm:"not null"`
	Region      string  `gorm:"size:8;not null"`
}

func NewServer added in v0.0.10

func NewServer(
	name string,
	description string,
	rules string,
	iconURI string,
	bannerURI string,
	ownerId uint,
	region string,
) *Server

type Tag added in v0.0.10

type Tag struct {
	Entity
	Name             string         `gorm:"uniqueIndex"`
	Priority         uint32         `gorm:"default:0"`
	Permissions      PermissionMask `gorm:"foreignKey:FkPermissionMask"`
	FkPermissionMask uint
}

func NewTag added in v0.0.10

func NewTag(name string, priority uint32, fkPermission uint) *Tag

type TextMessage added in v0.0.10

type TextMessage struct {
	Entity
	Content   string  `gorm:"type:text"`
	User      User    `gorm:"foreignKey:FkUser"`
	Channel   Channel `gorm:"foreignKey:FkChannel"`
	FkUser    uint
	FkChannel uint
}

func NewTextMessage added in v0.0.10

func NewTextMessage(content string, fkUser uint, fkChannel uint) *TextMessage

type User added in v0.0.10

type User struct {
	Entity
	Name   string `gorm:"uniqueIndex"`
	RoleId uint   `gorm:"not null"`
	Role   Role
	Tags   []*Tag `gorm:"many2many:user_tags"`
}

func NewUser added in v0.0.10

func NewUser(name string, roleId uint) *User

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL