 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Overview ¶
Package storage contains a storage interface.
Index ¶
Constants ¶
      View Source
      
  const PDVDenominator = 1000000
    PDVDenominator is used to guarantee precision for storing pdv with int64.
Variables ¶
      View Source
      
  var ErrNotFound = fmt.Errorf("not found")
    ErrNotFound ...
Functions ¶
This section is empty.
Types ¶
type CreatePostParams ¶
type CreatePostParams struct {
	UUID         string
	Owner        string
	Title        string
	Category     community.Category
	PreviewImage string
	Text         string
	CreatedAt    time.Time
}
    CreatePostParams ...
type DecentrStats ¶ added in v0.0.14
DecentrStats represents all users stats.
type ListPostsParams ¶
type ListPostsParams struct {
	SortBy     SortType
	OrderBy    OrderType
	Limit      uint16
	Category   *community.Category
	Owner      *string
	LikedBy    *string
	FollowedBy *string
	After      *PostID
	From       *uint64
	To         *uint64
}
    ListPostsParams ...
type OrderType ¶
type OrderType string
OrderType ...
const ( // AscendingOrder ... AscendingOrder OrderType = "asc" // DescendingOrder ... DescendingOrder = "desc" )
type Post ¶
type Post struct {
	UUID         string
	Owner        string
	Title        string
	Category     community.Category
	PreviewImage string
	Text         string
	CreatedAt    time.Time
	Likes        uint32
	Dislikes     uint32
	UPDV         int64
	Slug         string
}
    Post ...
type ProfileStats ¶ added in v1.0.0
ProfileStats ...
type Storage ¶
type Storage interface {
	InTx(ctx context.Context, f func(s Storage) error) error
	SetHeight(ctx context.Context, height uint64) error
	GetHeight(ctx context.Context) (uint64, error)
	RefreshViews(ctx context.Context) error
	Follow(ctx context.Context, follower, followee string) error
	Unfollow(ctx context.Context, follower, followee string) error
	ListPosts(ctx context.Context, p *ListPostsParams) ([]*Post, error)
	CreatePost(ctx context.Context, p *CreatePostParams) error
	GetPost(ctx context.Context, id PostID) (*Post, error)
	GetPostBySlug(ctx context.Context, slug string) (*Post, error)
	DeletePost(ctx context.Context, id PostID, timestamp time.Time, deletedBy string) error
	GetLikes(ctx context.Context, likedBy string, id ...PostID) (map[PostID]community.LikeWeight, error)
	SetLike(ctx context.Context, id PostID, weight community.LikeWeight, timestamp time.Time, likeOwner string) error
	AddPDV(ctx context.Context, address string, amount int64, timestamp time.Time) error
	GetProfileStats(ctx context.Context, addr ...string) ([]*ProfileStats, error)
	GetPostStats(ctx context.Context, id ...PostID) (map[PostID]Stats, error)
	GetDecentrStats(ctx context.Context) (*DecentrStats, error)
	ResetAccount(ctx context.Context, owner string) error
}
    Storage provides methods for interacting with database.
 Click to show internal directories. 
   Click to hide internal directories.