structs

package
v0.0.0-...-4274f6d Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2020 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

type Asset struct {
	ID           int64 `gorm:"column:asset_id;primary_key"`
	Width        uint
	Height       uint
	ResourceType string `gorm:"column:resource_type;default:'image'" json:"resource_type"`
	URL          string
	SecureURL    string `gorm:"column:secure_url" json:"secure_url"`
	CreatedAt    uint64 `gorm:"column:created_at" json:"created_at"`
}

type Content

type Content struct {
	Type   string  `gorm:"column:content_type;default:'text'"`
	Text   string  `gorm:"column:text"`
	NSFW   bool    `gorm:"column:NSFW"`
	Source []Asset `gorm:"-"`
}

Content represent the inside of the post

type Entity

type Entity struct {
	ID     int64 `gorm:"column:entity_id;primary_key"`
	UserID uint
	// This Type field correspond to the ENTITY_TYPE
	Type      string  `gorm:"default:'post'"`
	Inside    Content `gorm:"EMBEDDED"`
	Likes     uint
	CreatedAt uint64     `gorm:"column:created_at" json:"created_at"`
	EditedAt  uint64     `gorm:"column:edited_at" json:"edited_at"`
	AnswerOf  graphql.ID `gorm:"column:answer_of" json:"answer_of"`
	// This is only used for recursivity and filtering
	Depth uint `gorm:"-" json:"-"`
}

Entity struct represent the Posts and Comments

type Settings

type Settings struct {
	ID        uint  `gorm:"column:setting_id;primary_key"`
	UserID    int64 `gorm:"primary_key"`
	ShowLikes bool  `gorm:"column:show_likes" json:"show_likes"`
	ShowNSFW  bool  `gorm:"column:show_nsfw" json:"show_nsfw"`
	NSFWPage  bool  `gorm:"column:nsfw_page" json:"nsfw_page"`
}

Settings represent the user's account settings

type User

type User struct {
	ID       int64 `gorm:"column:user_id;primary_key"`
	Username string
	Password string
	Email    string
	Fullname string

	Bio       string
	AvatarURL string `gorm:"column:avatar_url;default:'default_komfy_profile_url'" json:"avatar_url"`
	CreatedAt uint64 `gorm:"column:created_at" json:"created_at"`
	Checked   bool
	// `-` means we ignore the settings field when working with gorm
	Settings Settings `gorm:"-"`
}

User struct inside database

Jump to

Keyboard shortcuts

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