Documentation ¶
Index ¶
- type ActiveVotesWorker
- type ActivitySinceRangeFilter
- type Categories
- type CategoryFilter
- type Consumer
- type Dao
- type DaoID
- type DaoIDProvider
- type DaoIDRepo
- type DaoIDService
- type DaoIDsFilter
- type DaoList
- type DataProvider
- type Filter
- type NameFilter
- type NewCategoryWorker
- type NotCategoryFilter
- type OrderByFollowersFilter
- type OrderByPopularityIndexFilter
- type OrderByVotersFilter
- type PageFilter
- type PopularCategoryWorker
- type ProposalProvider
- type Publisher
- type Repo
- func (r *Repo) Create(dao Dao) error
- func (r *Repo) GetByFilters(filters []Filter, count bool) (DaoList, error)
- func (r *Repo) GetByID(id uuid.UUID) (*Dao, error)
- func (r *Repo) GetByName(name string) (*Dao, error)
- func (r *Repo) GetByOriginalID(id string) (*Dao, error)
- func (r *Repo) GetCategories() ([]string, error)
- func (r *Repo) Update(dao Dao) error
- func (r *Repo) UpdateActiveVotes(id uuid.UUID) error
- func (r *Repo) UpdateActiveVotesAll() error
- func (r *Repo) UpdateProposalCnt(id uuid.UUID) error
- type Server
- func (s *Server) GetByFilter(_ context.Context, req *proto.DaoByFilterRequest) (*proto.DaoByFilterResponse, error)
- func (s *Server) GetByID(_ context.Context, req *proto.DaoByIDRequest) (*proto.DaoByIDResponse, error)
- func (s *Server) GetTopByCategories(ctx context.Context, req *proto.TopByCategoriesRequest) (*proto.TopByCategoriesResponse, error)
- type Service
- func (s *Service) GetByFilters(filters []Filter) (DaoList, error)
- func (s *Service) GetByID(id uuid.UUID) (*Dao, error)
- func (s *Service) GetIDByOriginalID(id string) (uuid.UUID, error)
- func (s *Service) GetTopByCategories(_ context.Context, limit int) (map[string]topList, error)
- func (s *Service) HandleActivitySince(_ context.Context, id uuid.UUID) (*Dao, error)
- func (s *Service) HandleDao(ctx context.Context, dao Dao) error
- func (s *Service) PrefillDaoIDs() error
- func (s *Service) ProcessExistedProposal(_ context.Context, originalDaoID string) error
- func (s *Service) ProcessNewProposal(_ context.Context, originalDaoID string) error
- func (s *Service) ProcessPopularityIndexUpdate(_ context.Context, id uuid.UUID, index float64) error
- func (s *Service) ProcessUniqueVoters(_ context.Context, voters []UniqueVoter) error
- type Strategies
- type Strategy
- type Treasuries
- type Treasury
- type UniqueVoter
- type UniqueVoterProvider
- type UniqueVoterRepo
- type VotersCountWorker
- type Voting
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActiveVotesWorker ¶
type ActiveVotesWorker struct {
// contains filtered or unexported fields
}
func NewActiveVotesWorker ¶
func NewActiveVotesWorker(s *Service) *ActiveVotesWorker
type Categories ¶
type Categories []string
type CategoryFilter ¶
type CategoryFilter struct {
Category string
}
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
func NewConsumer ¶
type Dao ¶
type Dao struct { ID uuid.UUID `gorm:"primary_key"` CreatedAt time.Time UpdatedAt time.Time OriginalID string Name string Private bool About string Avatar string Terms string Location string Website string Twitter string Github string Coingecko string Email string Network string Symbol string Skin string Domain string Strategies Strategies `gorm:"serializer:json"` Voting Voting `gorm:"serializer:json"` Categories Categories `gorm:"serializer:json"` Treasures Treasuries `gorm:"serializer:json"` FollowersCount int ProposalsCount int Guidelines string Template string ParentID *uuid.UUID ActivitySince int VotersCount int PopularityIndex float64 ActiveVotes int Verified bool }
type DaoIDProvider ¶
type DaoIDRepo ¶
type DaoIDRepo struct {
// contains filtered or unexported fields
}
func NewDaoIDRepo ¶
type DaoIDService ¶
type DaoIDService struct {
// contains filtered or unexported fields
}
func NewDaoIDService ¶
func NewDaoIDService(repo *DaoIDRepo) *DaoIDService
func (*DaoIDService) GetAll ¶
func (s *DaoIDService) GetAll() ([]DaoID, error)
func (*DaoIDService) GetOrCreate ¶
func (s *DaoIDService) GetOrCreate(originID string) (uuid.UUID, error)
type DaoIDsFilter ¶
type DaoIDsFilter struct {
DaoIDs []string
}
type DataProvider ¶
type DataProvider interface { Create(dao Dao) error Update(dao Dao) error GetByID(id uuid.UUID) (*Dao, error) UpdateProposalCnt(id uuid.UUID) error UpdateActiveVotes(id uuid.UUID) error UpdateActiveVotesAll() error GetByFilters(filters []Filter, count bool) (DaoList, error) GetCategories() ([]string, error) }
type NameFilter ¶
type NameFilter struct {
Name string
}
type NewCategoryWorker ¶
type NewCategoryWorker struct {
// contains filtered or unexported fields
}
func NewNewCategoryWorker ¶
func NewNewCategoryWorker(s *Service) *NewCategoryWorker
func (*NewCategoryWorker) ProcessNew ¶
func (w *NewCategoryWorker) ProcessNew(ctx context.Context) error
func (*NewCategoryWorker) RemoveOutdated ¶
func (w *NewCategoryWorker) RemoveOutdated(ctx context.Context) error
type NotCategoryFilter ¶
type NotCategoryFilter struct {
Category string
}
type OrderByFollowersFilter ¶
type OrderByFollowersFilter struct { }
type OrderByPopularityIndexFilter ¶
type OrderByPopularityIndexFilter struct { }
type OrderByVotersFilter ¶
type OrderByVotersFilter struct { }
type PageFilter ¶
type PopularCategoryWorker ¶
type PopularCategoryWorker struct {
// contains filtered or unexported fields
}
func NewPopularCategoryWorker ¶
func NewPopularCategoryWorker(s *Service) *PopularCategoryWorker
type ProposalProvider ¶
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
func (*Repo) GetByFilters ¶
todo: add order by
func (*Repo) GetCategories ¶
func (*Repo) Update ¶
Update single dao object in database todo: think about updating fields to default value(boolean, string etc)
func (*Repo) UpdateActiveVotesAll ¶
type Server ¶
type Server struct { proto.UnimplementedDaoServer // contains filtered or unexported fields }
func (*Server) GetByFilter ¶
func (s *Server) GetByFilter(_ context.Context, req *proto.DaoByFilterRequest) (*proto.DaoByFilterResponse, error)
func (*Server) GetByID ¶
func (s *Server) GetByID(_ context.Context, req *proto.DaoByIDRequest) (*proto.DaoByIDResponse, error)
func (*Server) GetTopByCategories ¶
func (s *Server) GetTopByCategories(ctx context.Context, req *proto.TopByCategoriesRequest) (*proto.TopByCategoriesResponse, error)
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(r DataProvider, ur UniqueVoterProvider, ip DaoIDProvider, p Publisher, pp ProposalProvider) (*Service, error)
func (*Service) GetIDByOriginalID ¶
func (*Service) GetTopByCategories ¶
func (*Service) HandleActivitySince ¶
func (*Service) PrefillDaoIDs ¶
func (*Service) ProcessExistedProposal ¶
func (*Service) ProcessNewProposal ¶
func (*Service) ProcessPopularityIndexUpdate ¶
func (*Service) ProcessUniqueVoters ¶
func (s *Service) ProcessUniqueVoters(_ context.Context, voters []UniqueVoter) error
type Strategies ¶
type Strategies []Strategy
type Treasuries ¶
type Treasuries []Treasury
type UniqueVoter ¶
func (UniqueVoter) TableName ¶
func (UniqueVoter) TableName() string
type UniqueVoterProvider ¶
type UniqueVoterProvider interface { BatchCreate([]UniqueVoter) error UpdateVotersCount() error }
type UniqueVoterRepo ¶
type UniqueVoterRepo struct {
// contains filtered or unexported fields
}
func NewUniqueVoterRepo ¶
func NewUniqueVoterRepo(db *gorm.DB) *UniqueVoterRepo
func (*UniqueVoterRepo) BatchCreate ¶
func (r *UniqueVoterRepo) BatchCreate(data []UniqueVoter) error
func (*UniqueVoterRepo) UpdateVotersCount ¶
func (r *UniqueVoterRepo) UpdateVotersCount() error
type VotersCountWorker ¶
type VotersCountWorker struct {
// contains filtered or unexported fields
}
func NewVotersCountWorker ¶
func NewVotersCountWorker(s *Service) *VotersCountWorker
func (*VotersCountWorker) ProcessNew ¶
func (w *VotersCountWorker) ProcessNew(ctx context.Context) error
Click to show internal directories.
Click to hide internal directories.