Documentation
¶
Overview ¶
Package storage contains a storage interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = fmt.Errorf("not found")
ErrNotFound ...
View Source
var ErrRequestedHeightIsTooHigh = errors.New("requested height is too high")
ErrRequestedHeightIsTooHigh returned when the height requested in WithLockedHeight function is more than expected.
View Source
var ErrRequestedHeightIsTooLow = errors.New("requested height is too low")
ErrRequestedHeightIsTooLow returned when the height requested in WithLockedHeight function is less than expected.
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 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 }
Post ...
type Profile ¶
type Profile struct { Address string FirstName string LastName string Bio string Avatar string Gender string Birthday string CreatedAt time.Time }
Profile ...
type Storage ¶
type Storage interface { WithLockedHeight(ctx context.Context, height uint64, f func(s Storage) error) error GetHeight(ctx context.Context) (uint64, error) GetProfiles(ctx context.Context, addr ...string) ([]*Profile, error) SetProfile(ctx context.Context, p *Profile) 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) 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 GetStats(ctx context.Context, id ...PostID) (map[PostID]Stats, error) }
Storage provides methods for interacting with database.
Click to show internal directories.
Click to hide internal directories.