models

package
v0.0.0-...-efe2ce5 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0, MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const (
	VoteDirUp   = VoteDir(1)
	VoteDirDown = VoteDir(2)
)

Variables

This section is empty.

Functions

func ClientForPds

func ClientForPds(pds *PDS) *xrpc.Client

Types

type ActorInfo

type ActorInfo struct {
	gorm.Model
	Uid         Uid            `gorm:"uniqueindex"`
	Handle      sql.NullString `gorm:"index"`
	DisplayName string
	Did         string `gorm:"uniqueindex"`
	Following   int64
	Followers   int64
	Posts       int64
	Type        string
	PDS         uint
	ValidHandle bool `gorm:"default:true"`
}

func (*ActorInfo) ActorRef

func (ai *ActorInfo) ActorRef() *bsky.ActorDefs_ProfileViewBasic

func (*ActorInfo) ActorView

func (ai *ActorInfo) ActorView() *bsky.ActorDefs_ProfileView

TODO: this is just s stub; needs to populate more info

type DbCID

type DbCID struct {
	CID cid.Cid
}

func (*DbCID) GormDataType

func (dbc *DbCID) GormDataType() string

func (DbCID) MarshalJSON

func (dbc DbCID) MarshalJSON() ([]byte, error)

func (*DbCID) Scan

func (dbc *DbCID) Scan(v interface{}) error

func (*DbCID) UnmarshalJSON

func (dbc *DbCID) UnmarshalJSON(b []byte) error

func (DbCID) Value

func (dbc DbCID) Value() (driver.Value, error)

type DomainBan

type DomainBan struct {
	gorm.Model
	Domain string
}

type FeedPost

type FeedPost struct {
	gorm.Model
	Author      Uid    `gorm:"index:idx_feedpost_rkey,unique"`
	Rkey        string `gorm:"index:idx_feedpost_rkey,unique"`
	Cid         string
	UpCount     int64
	ReplyCount  int64
	RepostCount int64
	ReplyTo     uint
	Missing     bool
	Deleted     bool
}

type FollowRecord

type FollowRecord struct {
	gorm.Model
	Follower Uid
	Target   Uid
	Rkey     string
	Cid      string
}

type Label

type Label struct {
	ID        uint64  `gorm:"primaryKey"`
	Uri       string  `gorm:"uniqueIndex:idx_uri_src_val_cid;not null"`
	SourceDid string  `gorm:"uniqueIndex:idx_uri_src_val_cid;uniqueIndex:idx_src_rkey;not null"`
	Val       string  `gorm:"uniqueIndex:idx_uri_src_val_cid;not null"`
	Cid       *string `gorm:"uniqueIndex:idx_uri_src_val_cid"`
	Neg       *bool
	RepoRKey  *string `gorm:"uniqueIndex:idx_src_rkey"`
	CreatedAt time.Time
	UpdatedAt time.Time
}

The CreatedAt column corresponds to the 'cat' timestamp on label records. The UpdatedAt column is database-specific.

NOTE: to get fast string-prefix queries on Uri via the idx_uri_src_val_cid index, it is important that the PostgreSQL LC_COLLATE="C"

type ModerationAction

type ModerationAction struct {
	ID             uint64 `gorm:"primaryKey"`
	Action         string `gorm:"not null"`
	SubjectType    string `gorm:"not null"`
	SubjectDid     string `gorm:"not null"`
	SubjectUri     *string
	SubjectCid     *string
	Reason         string    `gorm:"not null"`
	CreatedAt      time.Time `gorm:"not null"`
	CreatedByDid   string    `gorm:"not null"`
	ReversedAt     *time.Time
	ReversedByDid  *string
	ReversedReason *string
}

type ModerationActionSubjectBlobCid

type ModerationActionSubjectBlobCid struct {
	// TODO: foreign key
	ActionId uint64 `gorm:"primaryKey"`
	Cid      string `gorm:"primaryKey"`
}

type ModerationReport

type ModerationReport struct {
	ID            uint64 `gorm:"primaryKey"`
	SubjectType   string `gorm:"not null"`
	SubjectDid    string `gorm:"not null"`
	SubjectUri    *string
	SubjectCid    *string
	ReasonType    string `gorm:"not null"`
	Reason        *string
	ReportedByDid string    `gorm:"not null"`
	CreatedAt     time.Time `gorm:"not null"`
}

type ModerationReportResolution

type ModerationReportResolution struct {
	// TODO: foreign key
	ReportId uint64 `gorm:"primaryKey"`
	// TODO: foreign key
	ActionId     uint64    `gorm:"primaryKey;index:"`
	CreatedAt    time.Time `gorm:"not null"`
	CreatedByDid string    `gorm:"not null"`
}

type PDS

type PDS struct {
	gorm.Model

	Host       string
	Did        string
	SSL        bool
	Cursor     int64
	Registered bool
	Blocked    bool

	RateLimit      float64
	CrawlRateLimit float64

	RepoCount int64
	RepoLimit int64

	HourlyEventLimit int64
	DailyEventLimit  int64
}

type RepostRecord

type RepostRecord struct {
	ID         uint `gorm:"primarykey"`
	CreatedAt  time.Time
	RecCreated string
	Post       uint
	Reposter   Uid
	Author     Uid
	RecCid     string
	Rkey       string
}

type Uid

type Uid uint64

type VoteDir

type VoteDir int

func (VoteDir) String

func (vd VoteDir) String() string

type VoteRecord

type VoteRecord struct {
	gorm.Model
	Dir     VoteDir
	Voter   Uid
	Post    uint
	Created string
	Rkey    string
	Cid     string
}

Jump to

Keyboard shortcuts

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