model

package
v0.0.0-...-3cdc2b7 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusActive   = "active"
	StatusDeleting = "deleting"
)
View Source
const (
	StatusDefault  = "default"
	StatusRemoved  = "removed"
	StatusAccepted = "accepted"
	StatusBlocked  = "blocked"
)

status "default", "removed", , "accepted", "blocked"

View Source
const (
	StatusOnline  = "online"
	StatusOffline = "offline"
)
View Source
const (
	DefaultGroupImage = "" /* 155-byte string literal not displayed */
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	ID        uint           `gorm:"primarykey" json:"id"`
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `gorm:"index" json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at"`
}

type Conn

type Conn struct {
	UserID uint   `json:"user_id" gorm:"primaryKey"`
	Topic  string `json:"topic" gorm:"primaryKey"`
	Count  int64  `json:"count"`
	User   *User  `json:"user"`
}

type Group

type Group struct {
	Base
	Name        string        `json:"name"`
	Description string        `json:"description"`
	ImageURL    string        `json:"image_url"`
	Host        string        `json:"-"`
	Topic       uuid.UUID     `json:"-" gorm:"type:uuid;default:uuid_generate_v4()"`
	OwnerID     uint          `json:"owner_id"`
	Owner       *User         `json:"owner" gorm:"foreignKey:OwnerID"`
	Memberships []*Membership `json:"memberships"`
}

type Membership

type Membership struct {
	CreatedAt    time.Time        `json:"created_at"`
	UserID       uint             `json:"user_id" gorm:"primaryKey"`
	GroupID      uint             `json:"group_id" gorm:"primaryKey"`
	Status       membershipStatus `json:"status" gorm:"type:membership_status"`
	Notification bool             `json:"-"`
	User         *User            `json:"user"`
	Group        *Group           `json:"group"`
}

type Relationship

type Relationship struct {
	User1ID               uint      `json:"user1_id" gorm:"primaryKey"`
	User2ID               uint      `json:"user2_id" gorm:"primaryKey"`
	User1                 *User     `json:"user1" gorm:"foreignKey:User1ID"`
	User2                 *User     `json:"user2" gorm:"foreignKey:User2ID"`
	ForwardStatus         string    `json:"forward_status"`
	BackwardStatus        string    `json:"backward_status"`
	ForwardNotifications  bool      `json:"forward_notifications"`
	BackwardNotifications bool      `json:"backward_notifications"`
	Host                  string    `json:"-"`
	Topic                 uuid.UUID `json:"-" gorm:"type:uuid;default:uuid_generate_v4()"`
}

type Session

type Session struct {
	UserID        uint           `json:"user_id" gorm:"primaryKey"`
	IP            string         `json:"ip" gorm:"primaryKey"`
	CreatedAt     time.Time      `json:"created_at"`
	UpdatedAt     time.Time      `json:"updated_at"`
	DeletedAt     gorm.DeletedAt `gorm:"index" json:"deleted_at"`
	Ch            string         `json:"-"`
	ExpoPushToken string         `json:"-"`
	Status        string         `json:"status"`
}

type User

type User struct {
	Base
	Email                 string          `gorm:"unique" json:"email"`
	Username              string          `gorm:"unique" json:"username"`
	Displayname           string          `json:"displayname"`
	ImageURL              string          `json:"image_url"`
	Pass                  string          `json:"-"`
	Bio                   string          `json:"bio"`
	Memberships           []*Membership   `json:"memberships"`
	Sessions              []*Session      `json:"sessions"`
	ForwardRelationships  []*Relationship `json:"forward_relationships" gorm:"foreignKey:User1ID"`
	BackwardRelationships []*Relationship `json:"backward_relationships" gorm:"foreignKey:User2ID"`
}

Jump to

Keyboard shortcuts

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