Documentation
¶
Index ¶
- func IdToCacheKey(id string) string
- type Category
- type Core
- func (c *Core) Create(ctx context.Context, np NewPost, userAddressHex string) (Post, error)
- func (c *Core) Query(ctx context.Context, page uint64, pageSize uint64) ([]Post, error)
- func (c *Core) QueryByAddress(ctx context.Context, userAddressHex string, page uint64, pageSize uint64) ([]Post, error)
- func (c *Core) QueryById(ctx context.Context, id *big.Int) (Post, error)
- func (c *Core) QueryByIndex(ctx context.Context, userAddressHex string, index uint64) (Post, error)
- type NewPost
- type Post
- type Storer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IdToCacheKey ¶
Types ¶
type Core ¶
type Core struct {
// contains filtered or unexported fields
}
func NewCore ¶
func NewCore(postContract *contract.PostContract, admin auth.ContractSigner, cacheStorer cachestore.CacheStore) *Core
func (*Core) QueryByAddress ¶
type Post ¶
type Post struct {
ID *big.Int `json:"id"`
Author common.Address `json:"author"`
Title string `json:"title"`
Content string `json:"content"`
Timestamp *big.Int `json:"timestamp"`
Category Category `json:"category"`
Tags []string `json:"tags"`
Media map[string]string `json:"media"` //[name]url
}
func (*Post) CacheExpiration ¶
type Storer ¶
type Storer interface {
Create(ctx context.Context, np NewPost, userAddressHex string) (Post, error)
Query(ctx context.Context, page uint64, pageSize uint64) ([]Post, error)
QueryByAddress(ctx context.Context, userAddressHex string, page uint64, pageSize uint64) ([]Post, error)
QueryByIndex(ctx context.Context, userAddressHex string, index uint64) (Post, error)
QueryById(ctx context.Context, id *big.Int) (Post, error)
}
Click to show internal directories.
Click to hide internal directories.