Documentation
¶
Index ¶
- Constants
- Variables
- func BrdNameFromAllPostTitle(title string) (string, bool)
- func IsValidArticleFileName(filename string) bool
- func IsValidBrdName(brdname string) bool
- func IsValidUserID(userID string) bool
- func MatchPrefixBytesToStrings(str []byte, patts []string) bool
- func ParseArticleFirstLine(line []byte) (tag1, val1, tag2, val2 []byte, ok bool)
- func ParseArticleMetaLine(line []byte) (tag, val []byte, ok bool)
- func ParseFileNameTime(filename string) (time.Time, error)
- func Subject(subject string) string
- type Aid
- type Article
- type ArticlePart
- type Board
- type BoardID
- type BoardRef
- type GrpcRemotePtt
- func (p *GrpcRemotePtt) GetArticleList(ref BoardRef, offset, length int) ([]Article, error)
- func (p *GrpcRemotePtt) GetArticleSelect(ref BoardRef, meth SelectMethod, filename, cacheKey string, offset, maxlen int) (*ArticlePart, error)
- func (p *GrpcRemotePtt) GetBoards(brefs ...BoardRef) ([]Board, error)
- func (p *GrpcRemotePtt) GetBottomList(ref BoardRef) ([]Article, error)
- func (p *GrpcRemotePtt) Hotboards() ([]Board, error)
- func (p *GrpcRemotePtt) Search(ref BoardRef, preds []SearchPredicate, offset, length int) ([]Article, int, error)
- type Pttbbs
- type SearchPredicate
- type SelectMethod
Constants ¶
View Source
const ( ArticleAuthor = "作者" ArticleTitle = "標題" AllPostBrdName = "ALLPOST" )
View Source
const ( FileLocal = 1 << iota FileMarked FileDigest FileBottom FileSolved )
Non-mail file modes
View Source
const ( FileRead = 1 << iota FileReplied FileMulti )
Mail file modes
View Source
const ( SelectPart SelectMethod = `articlepart` SelectHead = `articlehead` SelectTail = `articletail` )
View Source
const ( BoardGroup uint32 = 0x00000008 BoardOver18 = 0x01000000 )
Variables ¶
View Source
var ( ArticleFirstLineRegexp = regexp.MustCompile(`^(.+?): (.+) (.+?): (.+?)\n$`) ArticleMetaLineRegexp = regexp.MustCompile(`^(.+?): (.+)\n$`) QuotePrefixStrings = []string{": ", "> "} SignaturePrefixStrings = []string{"※", "==>"} ArticlePushPrefixStrings = []string{"推 ", "噓 ", "→ "} )
View Source
var (
ErrInvalidAid = errors.New("invalid aid")
)
View Source
var (
ErrNotFound = errors.New("not found")
)
Functions ¶
func BrdNameFromAllPostTitle ¶
BrdNameFromAllPostTitle returns the board name parsed from the post title in ALLPOST board.
func IsValidArticleFileName ¶
func IsValidBrdName ¶
func IsValidUserID ¶
func ParseArticleFirstLine ¶
func ParseArticleMetaLine ¶
Types ¶
type ArticlePart ¶
type Board ¶
type BoardRef ¶
type BoardRef interface {
// contains filtered or unexported methods
}
func BoardRefByBid ¶
func BoardRefByName ¶
func BoardRefsByBid ¶
type GrpcRemotePtt ¶
type GrpcRemotePtt struct {
// contains filtered or unexported fields
}
func NewGrpcRemotePtt ¶
func NewGrpcRemotePtt(boarddAddr string) (*GrpcRemotePtt, error)
func (*GrpcRemotePtt) GetArticleList ¶
func (p *GrpcRemotePtt) GetArticleList(ref BoardRef, offset, length int) ([]Article, error)
func (*GrpcRemotePtt) GetArticleSelect ¶
func (p *GrpcRemotePtt) GetArticleSelect(ref BoardRef, meth SelectMethod, filename, cacheKey string, offset, maxlen int) (*ArticlePart, error)
func (*GrpcRemotePtt) GetBoards ¶
func (p *GrpcRemotePtt) GetBoards(brefs ...BoardRef) ([]Board, error)
func (*GrpcRemotePtt) GetBottomList ¶
func (p *GrpcRemotePtt) GetBottomList(ref BoardRef) ([]Article, error)
func (*GrpcRemotePtt) Hotboards ¶
func (p *GrpcRemotePtt) Hotboards() ([]Board, error)
func (*GrpcRemotePtt) Search ¶
func (p *GrpcRemotePtt) Search(ref BoardRef, preds []SearchPredicate, offset, length int) ([]Article, int, error)
type Pttbbs ¶
type Pttbbs interface { GetBoards(refs ...BoardRef) ([]Board, error) GetArticleList(ref BoardRef, offset, length int) ([]Article, error) GetBottomList(ref BoardRef) ([]Article, error) GetArticleSelect(ref BoardRef, meth SelectMethod, filename, cacheKey string, offset, maxlen int) (*ArticlePart, error) Hotboards() ([]Board, error) Search(ref BoardRef, preds []SearchPredicate, offset, length int) (articles []Article, totalPosts int, err error) }
type SearchPredicate ¶
type SearchPredicate interface {
// contains filtered or unexported methods
}
func WithAuthor ¶
func WithAuthor(author string) SearchPredicate
func WithExactTitle ¶
func WithExactTitle(title string) SearchPredicate
func WithRecommend ¶
func WithRecommend(n int) SearchPredicate
func WithTitle ¶
func WithTitle(title string) SearchPredicate
type SelectMethod ¶
type SelectMethod string
Click to show internal directories.
Click to hide internal directories.