[feature] Add postDataCallbackFunc to allow cleanup (#408)

This commit is contained in:
tobi
2022-02-22 13:50:33 +01:00
committed by GitHub
parent 15d1e6b3a1
commit 55b83bea7c
10 changed files with 146 additions and 24 deletions

View File

@@ -119,3 +119,9 @@ type AdditionalEmojiInfo struct {
// DataFunc represents a function used to retrieve the raw bytes of a piece of media.
type DataFunc func(ctx context.Context) (reader io.Reader, fileSize int, err error)
// PostDataCallbackFunc represents a function executed after the DataFunc has been executed,
// and the returned reader has been read. It can be used to clean up any remaining resources.
//
// This can be set to nil, and will then not be executed.
type PostDataCallbackFunc func(ctx context.Context) error