Documentation ¶
Index ¶
- type Message
- type MessagePicture
- type MessageVideo
- type SimilarMessage
- type Storage
- func (s *Storage) FindMsgPictureFilter(chatID int64, limit int, ...) ([]*SimilarMessage, error)
- func (s *Storage) FindMsgVideoFilter(chatID int64, limit int, ...) ([]*SimilarMessage, error)
- func (s *Storage) SaveMessagePicture(msg *models.Message, pHash *goimagehash.ImageHash, ...) error
- func (s *Storage) SaveMessageVideo(msg *models.Message, pHashes, dHashes *VideoHashes) error
- type VideoHashes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MessagePicture ¶
type MessagePicture struct { ID int UserID int ChatID int SentDate time.Time PHash *goimagehash.ImageHash DHash *goimagehash.ImageHash }
type MessageVideo ¶
type MessageVideo struct { Msg Message PHashes VideoHashes DHashes VideoHashes }
type SimilarMessage ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
func (*Storage) FindMsgPictureFilter ¶
func (s *Storage) FindMsgPictureFilter(chatID int64, limit int, filter func(msg *MessagePicture) (dist int, ok bool, err error)) ([]*SimilarMessage, error)
FindMsgPictureFilter finds messages in the database and applies a filter to them. The filter function should return the distance between the hashes, whether the message is a match and an error if any. The messages are sorted by distance in descending order. If limit is 0, all matches are returned.
func (*Storage) FindMsgVideoFilter ¶
func (s *Storage) FindMsgVideoFilter(chatID int64, limit int, filter func(msg *MessageVideo) (dist int, ok bool, err error)) ([]*SimilarMessage, error)
func (*Storage) SaveMessagePicture ¶
func (s *Storage) SaveMessagePicture(msg *models.Message, pHash *goimagehash.ImageHash, dHash *goimagehash.ImageHash) error
func (*Storage) SaveMessageVideo ¶
func (s *Storage) SaveMessageVideo(msg *models.Message, pHashes, dHashes *VideoHashes) error
type VideoHashes ¶
type VideoHashes struct { FrameA *goimagehash.ImageHash FrameB *goimagehash.ImageHash FrameC *goimagehash.ImageHash FrameD *goimagehash.ImageHash }
func LoadVideoHashes ¶
func LoadVideoHashes(b io.Reader) (*VideoHashes, error)
LoadVideoHashes method loads a VideoHashes from io.Reader.
Click to show internal directories.
Click to hide internal directories.