item

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2024 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeDao      Type = "dao"
	TypeProposal Type = "proposal"

	None                        TimelineAction = ""
	DaoCreated                  TimelineAction = "dao.created"
	DaoUpdated                  TimelineAction = "dao.updated"
	ProposalCreated             TimelineAction = "proposal.created"
	ProposalUpdated             TimelineAction = "proposal.updated"
	ProposalVotingStartsSoon    TimelineAction = "proposal.voting.starts_soon"
	ProposalVotingEndsSoon      TimelineAction = "proposal.voting.ends_soon"
	ProposalVotingStarted       TimelineAction = "proposal.voting.started"
	ProposalVotingQuorumReached TimelineAction = "proposal.voting.quorum_reached"
	ProposalVotingEnded         TimelineAction = "proposal.voting.ended"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionFilter

type ActionFilter struct {
	Actions []string
}

func (ActionFilter) Apply

func (f ActionFilter) Apply(db *gorm.DB) *gorm.DB

type ActiveFilter

type ActiveFilter struct {
	IsActive bool
}

func (ActiveFilter) Apply

func (f ActiveFilter) Apply(db *gorm.DB) *gorm.DB

type DaoConsumer

type DaoConsumer struct {
	// contains filtered or unexported fields
}

func NewDaoConsumer

func NewDaoConsumer(nc *nats.Conn, s *Service) (*DaoConsumer, error)

func (*DaoConsumer) Start

func (c *DaoConsumer) Start(ctx context.Context) error

type DaoIDFilter

type DaoIDFilter struct {
	IDs []string
}

func (DaoIDFilter) Apply

func (f DaoIDFilter) Apply(db *gorm.DB) *gorm.DB

type DataProvider

type DataProvider interface {
	Save(item *FeedItem) error
	GetDaoItem(id uuid.UUID) (*FeedItem, error)
	GetProposalItem(id string) (*FeedItem, error)
	GetByFilters(filters []Filter) (FeedList, error)
}

type FeedItem

type FeedItem struct {
	ID          uuid.UUID `gorm:"primarykey"`
	CreatedAt   time.Time
	UpdatedAt   time.Time
	DeletedAt   gorm.DeletedAt `gorm:"index"`
	TriggeredAt time.Time      `gorm:"index"`

	DaoID        uuid.UUID
	ProposalID   string
	DiscussionID string
	Type         Type
	Action       TimelineAction

	Snapshot json.RawMessage
	Timeline Timeline `gorm:"serializer:json"`
}

type FeedList

type FeedList struct {
	Items      []FeedItem
	TotalCount int64
}

type Filter

type Filter interface {
	Apply(*gorm.DB) *gorm.DB
}

type OrderByTriggeredFilter

type OrderByTriggeredFilter struct {
}

func (OrderByTriggeredFilter) Apply

func (f OrderByTriggeredFilter) Apply(db *gorm.DB) *gorm.DB

type PageFilter

type PageFilter struct {
	Offset int
	Limit  int
}

func (PageFilter) Apply

func (f PageFilter) Apply(db *gorm.DB) *gorm.DB

type ProposalConsumer

type ProposalConsumer struct {
	// contains filtered or unexported fields
}

func NewProposalConsumer

func NewProposalConsumer(nc *nats.Conn, s *Service) (*ProposalConsumer, error)

func (*ProposalConsumer) Start

func (c *ProposalConsumer) Start(ctx context.Context) error

type Publisher

type Publisher interface {
	PublishJSON(ctx context.Context, subject string, obj any) error
}

type Repo

type Repo struct {
	// contains filtered or unexported fields
}

func NewRepo

func NewRepo(conn *gorm.DB) *Repo

func (*Repo) GetByFilters

func (r *Repo) GetByFilters(filters []Filter) (FeedList, error)

func (*Repo) GetDaoItem

func (r *Repo) GetDaoItem(id uuid.UUID) (*FeedItem, error)

func (*Repo) GetProposalItem

func (r *Repo) GetProposalItem(id string) (*FeedItem, error)

func (*Repo) Save

func (r *Repo) Save(item *FeedItem) error

type Server

type Server struct {
	feedpb.UnimplementedFeedServer
	// contains filtered or unexported fields
}

func NewServer

func NewServer(sp *Service) *Server

func (*Server) GetByFilter

type Service

type Service struct {
	// contains filtered or unexported fields
}

func (*Service) GetByFilters

func (s *Service) GetByFilters(filters []Filter) (FeedList, error)

func (*Service) GetDaoItem

func (s *Service) GetDaoItem(_ context.Context, id uuid.UUID) (*FeedItem, error)

func (*Service) GetProposalItem

func (s *Service) GetProposalItem(_ context.Context, id string) (*FeedItem, error)

func (*Service) HandleItem

func (s *Service) HandleItem(ctx context.Context, item *FeedItem, sendUpdates bool) error

type SkipCanceled

type SkipCanceled struct {
}

func (SkipCanceled) Apply

func (f SkipCanceled) Apply(db *gorm.DB) *gorm.DB

type SkipSpammed

type SkipSpammed struct {
}

func (SkipSpammed) Apply

func (f SkipSpammed) Apply(db *gorm.DB) *gorm.DB

type SortedByActuality

type SortedByActuality struct {
}

func (SortedByActuality) Apply

func (f SortedByActuality) Apply(db *gorm.DB) *gorm.DB

type SubscriberProvider

type SubscriberProvider interface {
	GetByID(_ context.Context, id uuid.UUID) (*subscriber.Subscriber, error)
}

type SubscriptionProvider

type SubscriptionProvider interface {
	GetSubscribers(_ context.Context, daoID uuid.UUID) ([]uuid.UUID, error)
}

type Timeline

type Timeline []TimelineItem

func (*Timeline) AddNonUniqueAction

func (t *Timeline) AddNonUniqueAction(createdAt time.Time, action TimelineAction)

func (*Timeline) AddUniqueAction

func (t *Timeline) AddUniqueAction(createdAt time.Time, action TimelineAction) (isNew bool)

func (*Timeline) ContainsAction

func (t *Timeline) ContainsAction(action TimelineAction) bool

func (*Timeline) LastAction

func (t *Timeline) LastAction() TimelineAction

func (*Timeline) Sort

func (t *Timeline) Sort()

type TimelineAction

type TimelineAction string

func (TimelineAction) Equals

func (a TimelineAction) Equals(action TimelineAction) bool

type TimelineItem

type TimelineItem struct {
	CreatedAt time.Time      `json:"created_at"`
	Action    TimelineAction `json:"action"`
}

type Type

type Type string

type TypeFilter

type TypeFilter struct {
	Types []string
}

func (TypeFilter) Apply

func (f TypeFilter) Apply(db *gorm.DB) *gorm.DB

Jump to

Keyboard shortcuts

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