models

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

type Asset struct {
	ID            uint   `gorm:"primaryKey"`
	CID           string `gorm:"index;not null" json:"cid"`
	CreatorWallet string
	Creator       *User  `gorm:"references:Wallet"`
	ContentType   string `gorm:"not null" json:"contentType"`
	OwnerID       uint
	OwnerType     string
	CreatedAt     time.Time `gorm:"autoCreateTime"`
	UpdatedAt     time.Time `gorm:"autoUpdateTime"`
}

func (*Asset) MarshalJSON

func (a *Asset) MarshalJSON() ([]byte, error)

type Badge

type Badge struct {
	ID          uint   `gorm:"primaryKey" json:"-"`
	CID         string `json:"cid"`
	Name        string `gorm:"uniqueIndex" json:"name"`
	Description string `json:"description"`
}

type BadgeRelation

type BadgeRelation struct {
	ID        uint   `gorm:"primaryKey"`
	OwnerID   uint   `gorm:"not null"`
	OwnerType string `gorm:"not null"`
	BadgeName string
	Badge     *Badge `gorm:"foreignKey:BadgeName;references:Name"`
}

type Category

type Category struct {
	ID                uint   `gorm:"primaryKey"`
	CategoryGroupName string `gorm:"not null"`
	Color             string `gorm:"not null"`
	Name              string `gorm:"uniqueIndex;not null"`
}

func (*Category) MarshalJSON

func (c *Category) MarshalJSON() ([]byte, error)

type CategoryBlock

type CategoryBlock struct {
	CategoryGroupName string `json:"categoryGroupName"`
	Color             string `json:"color"`
	Name              string `json:"name"`
}

type CategoryGroup

type CategoryGroup struct {
	ID         uint           `gorm:"primaryKey"`
	Name       string         `gorm:"uniqueIndex;not null"`
	Color      string         `gorm:"not null"`
	Categories []*Category    `gorm:"foreignKey:CategoryGroupName;references:Name"`
	CreatedAt  time.Time      `gorm:"autoCreateTime"`
	DeletedAt  gorm.DeletedAt `gorm:"index"`
}

type CategoryGroupBlock

type CategoryGroupBlock struct {
	Name       string   `json:"name"`
	Color      string   `json:"color"`
	Categories []string `json:"categories"`
}

type CategoryRelation

type CategoryRelation struct {
	ID           uint `gorm:"primaryKey"`
	TopicID      uint
	CategoryName string         `gorm:"not null"`
	Category     *Category      `gorm:"foreignKey:CategoryName;references:Name"`
	CreatedAt    time.Time      `gorm:"autoCreateTime"`
	DeletedAt    gorm.DeletedAt `gorm:"index"`
}

type Community

type Community struct {
	ID          uint   `gorm:"primary_key"`
	Identifier  string `gorm:"not null;unique"`
	Name        string `gorm:"not null;unique"`
	Description string `gorm:"not null"`
}

type DeleteBlock

type DeleteBlock struct {
	Hash    string `json:"hash"`
	Creator string `json:"creator"`
}

type Downvote

type Downvote struct {
	ID            uint           `gorm:"primaryKey"`
	CreatedAt     time.Time      `gorm:"autoCreateTime"`
	DeletedAt     gorm.DeletedAt `gorm:"index"`
	CreatorWallet string         `gorm:"index:idx_wallet;not null"`
	Creator       *User          `gorm:"foreignKey:CreatorWallet;references:Wallet"`
	OwnerID       uint
	OwnerType     string
}

func (*Downvote) MarshalJSON

func (d *Downvote) MarshalJSON() ([]byte, error)

type DownvoteBlock

type DownvoteBlock struct {
	Hash    string `json:"hash"`
	Creator string `json:"creator"`
}

type Emoji

type Emoji struct {
	ID   uint   `gorm:"primaryKey"`
	Code string `gorm:"not null"`
}

type EmojiBlock

type EmojiBlock struct {
	Hash    string `json:"hash"`
	Creator string `json:"creator"`
	Code    string `json:"code"`
}

type EmojiRelation

type EmojiRelation struct {
	ID        uint           `gorm:"primaryKey"`
	EmojiCode string         `gorm:"index:,unique;not null"`
	Emoji     *Emoji         `gorm:"foreignKey:EmojiCode;references:Code"`
	OwnerID   uint           `gorm:"not null"`
	OwnerType string         `gorm:"not null"`
	CreatedAt time.Time      `gorm:"autoCreateTime"`
	DeletedAt gorm.DeletedAt `gorm:"index"`
}

type OwnedToken

type OwnedToken struct {
	ID           uint `gorm:"primaryKey"`
	OwnerID      uint
	Asset        *Asset         `gorm:"polymorphic:Owner;"`
	TagsAssigned []*TagRelation `gorm:"polymorphic:Owner;"`
	Volume       uint
}

type Post

type Post struct {
	ID            uint      `gorm:"primaryKey"`
	Hash          string    `gorm:"uniqueIndex"`
	CreatorWallet string    `gorm:"index;not null"`
	Creator       *User     `gorm:"references:Wallet"`
	Content       string    `gorm:"not null"`
	CreatedAt     time.Time `gorm:"autoCreateTime;not null"`
	UpdatedAt     time.Time `gorm:"autoUpdateTime;not null"`
	DeletedAt     gorm.DeletedAt
	ReplyToID     *uint
	ReplyTo       *Post
	BelongToHash  string `gorm:"index;not null"`
	BelongTo      *Topic `gorm:"references:Hash;foreignKey:BelongToHash"`

	Upvotes   []*Upvote   `gorm:"polymorphic:Owner"`
	Downvotes []*Downvote `gorm:"polymorphic:Owner"`
	Closed    bool        `gorm:"not null"`
	Assets    []*Asset    `gorm:"polymorphic:Owner"`
}

func (*Post) MarshalJSON

func (p *Post) MarshalJSON() ([]byte, error)

type PostBlock

type PostBlock struct {
	Hash     string   `json:"hash"`
	Creator  string   `json:"creator"`
	CID      string   `json:"cid"`
	ReplyTo  string   `json:"replyTo"`
	BelongTo string   `json:"belongTo"`
	Assets   []string `json:"assets,omitempty"`

	Deleted bool `json:"deleted"`

	Upvotes   []string            `json:"upvotes,omitempty"`
	Downvotes []string            `json:"downvotes,omitempty"`
	Emojis    map[string][]string `json:"emojis,omitempty"`
}

type PostRequest

type PostRequest struct {
	Content  string   `json:"content"`
	Images   []string `json:"images"`
	ReplyTo  string   `json:"replyTo"`
	BelongTo string   `json:"belongTo"`
}

type Profile

type Profile struct {
	ID                     uint `gorm:"primaryKey"`
	Signature              string
	Credibility            uint
	Balance                int
	UserWallet             *string          `gorm:"index:,unique,sort:desc,not null"`
	User                   *User            `gorm:"references:Wallet"`
	RoleRelationsAssigned  []*RoleRelation  `gorm:"polymorphic:Owner"`
	BadgeRelationsReceived []*BadgeRelation `gorm:"polymorphic:Owner"`
}

func (*Profile) MarshalJSON

func (p *Profile) MarshalJSON() ([]byte, error)

type ProfileBlock

type ProfileBlock struct {
	Username  string `json:"username"`
	Wallet    string `json:"wallet"`
	Avatar    string `json:"avatar"`
	Signature string `json:"signature"`
	Muted     bool   `json:"muted"`
	Banned    bool   `json:"banned"`

	Balance     int  `json:"balance"`
	Credibility uint `json:"credibility"`

	ActiveRole     string   `json:"activeRole"`
	RolesAssigned  []string `json:"rolesAssigned"`
	ActiveBadge    string   `json:"activeBadge"`
	BadgesReceived []string `json:"badgesReceived"`
}

type Role

type Role struct {
	ID          uint   `gorm:"primaryKey" json:"-"`
	Name        string `gorm:"uniqueIndex" json:"name"`
	Description string `json:"description"`
	Privilege   uint   `json:"priledge"`
}

type RoleRelation

type RoleRelation struct {
	ID        uint   `gorm:"primaryKey"`
	OwnerID   uint   `gorm:"not null"`
	OwnerType string `gorm:"not null"`
	RoleName  string
	Role      *Role `gorm:"foreignKey:RoleName;references:Name"`
}

type Tag

type Tag struct {
	ID            uint   `gorm:"primaryKey" json:"-"`
	Name          string `gorm:"uniqueIndex;not null"   json:"name"`
	CreatorWallet string `gorm:"not null"`
	Creator       *User  `gorm:"foreignKey:CreatorWallet;references:Wallet"`
	Description   string `json:"description"`
}

func (*Tag) MarshalJSON

func (t *Tag) MarshalJSON() ([]byte, error)

type TagBlock

type TagBlock struct {
	Name          string `json:"name"`
	CreatorWallet string `json:"creatorWallet"`
	Description   string `json:"description"`
}

type TagRelation

type TagRelation struct {
	ID        uint `gorm:"primaryKey"`
	OwnerID   uint
	OwnerType string
	TagName   string `gorm:"not null"`
	Tag       *Tag   `gorm:"foreignKey:TagName;references:Name"`
}

type Topic

type Topic struct {
	ID               uint   `gorm:"primaryKey"`
	Hash             string `gorm:"uniqueIndex;not null"`
	Title            string `gorm:"not null"`
	CreatorWallet    string `gorm:"index;not null"`
	Creator          *User  `gorm:"references:Wallet"`
	Content          string `gorm:"not null"`
	CategoryAssigned *CategoryRelation
	TagsAssigned     []*TagRelation `gorm:"polymorphic:Owner"`
	Upvotes          []*Upvote      `gorm:"polymorphic:Owner"`
	Downvotes        []*Downvote    `gorm:"polymorphic:Owner"`
	Assets           []*Asset       `gorm:"polymorphic:Owner"`
	Closed           bool           `gorm:"not null"`

	CreatedAt time.Time      `gorm:"autoCreateTime"`
	UpdatedAt time.Time      `gorm:"autoUpdateTime"`
	DeletedAt gorm.DeletedAt `gorm:"index"`
}

func (*Topic) MarshalJSON

func (t *Topic) MarshalJSON() ([]byte, error)

type TopicBlock

type TopicBlock struct {
	Hash     string   `json:"hash"`
	Title    string   `json:"title"`
	Creator  string   `json:"creator"`
	CID      string   `json:"cid"`
	Category string   `json:"category"`
	Tags     []string `json:"tags"`
	Images   []string `json:"images"`

	Deleted bool `json:"deleted"`

	Upvotes   []string            `json:"upvotes"`
	Downvotes []string            `json:"downvotes"`
	Emojis    map[string][]string `json:"emojis"`
}

type TradedToken

type TradedToken struct {
	ID           uint `gorm:"primaryKey"`
	OwnerID      uint
	Owner        *User
	Asset        *Asset         `gorm:"polymorphic:Owner;"`
	TagsAssigned []*TagRelation `gorm:"polymorphic:Owner;"`
	Upvotes      []*Upvote      `gorm:"polymorphic:Owner;"`
	Downvotes    []*Downvote    `gorm:"polymorphic:Owner;"`
	Value        uint
	Volume       uint
}

type Upvote

type Upvote struct {
	ID            uint           `gorm:"primaryKey"`
	CreatedAt     time.Time      `gorm:"autoCreateTime"`
	DeletedAt     gorm.DeletedAt `gorm:"index"`
	CreatorWallet string         `gorm:"index;not null"`
	Creator       *User          `gorm:"foreignKey:CreatorWallet;references:Wallet"`
	OwnerID       uint
	OwnerType     string
}

func (*Upvote) MarshalJSON

func (u *Upvote) MarshalJSON() ([]byte, error)

type UpvoteBlock

type UpvoteBlock struct {
	Hash    string `json:"hash"`
	Creator string `json:"creator"`
}

type User

type User struct {
	ID        uint   `gorm:"primaryKey"`
	Username  string `gorm:"not null"`
	Wallet    string `gorm:"index:,unique,sort:desc,not null"`
	Avatar    string
	Muted     bool           `gorm:"not null"`
	Banned    bool           `gorm:"not null"`
	CreatedAt time.Time      `gorm:"autoCreateTime"`
	UpdatedAt time.Time      `gorm:"autoUpdateTime"`
	DeletedAt gorm.DeletedAt `gorm:"index"`

	ActiveBadgeRelation *BadgeRelation `gorm:"polymorphic:Owner"`
	ActiveRoleRelation  *RoleRelation  `gorm:"polymorphic:Owner"`
}

func (*User) MarshalJSON

func (u *User) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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