dbase

package
v3.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2025 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidSessionID is returned when the session ID is invalid.
	ErrInvalidSessionID = errors.New("invalid session ID")
	// ErrIncomplete is returned when the session is incomplete.
	ErrIncomplete = errors.New("incomplete session")
)

Functions

This section is empty.

Types

type DBP

type DBP struct {
	// contains filtered or unexported fields
}

DBP is the database processor.

func New

func New(ctx context.Context, conn *sqlx.DB, p SessionInfo, opts ...Option) (*DBP, error)

New return the new database processor.

func (*DBP) Close

func (d *DBP) Close() error

Close finalises the session, marking it as finished. It is advised to check the error value.

func (*DBP) Encode

func (d *DBP) Encode(ctx context.Context, ch *chunk.Chunk) error

Encode inserts the chunk into the database.

func (*DBP) InsertChunk

func (d *DBP) InsertChunk(ctx context.Context, ch *chunk.Chunk) (int64, error)

InsertChunk inserts a chunk into the database.

func (*DBP) IsComplete

func (d *DBP) IsComplete(ctx context.Context, channelID string) (bool, error)

IsComplete returns true if the channel messages have been processed (there are no unfinished threads, and all messages were received).

func (*DBP) IsCompleteThread added in v3.1.1

func (d *DBP) IsCompleteThread(ctx context.Context, channelID, threadID string) (bool, error)

IsCompleteThread checks that thread with channelID and threadID is complete for thread-only archives. It returns true if there are no unfinished parts of the thread. It returns false if the thread is not found. It will return false on non-thread-only archives.

func (*DBP) Source

func (d *DBP) Source() *Source

Source returns the connection that can be used safely as a source.

func (*DBP) String

func (d *DBP) String() string

func (*DBP) UnsafeInsertChunk

func (d *DBP) UnsafeInsertChunk(ctx context.Context, txx repository.PrepareExtContext, ch *chunk.Chunk) (int64, error)

UnsafeInsertChunk does not lock the DBP and does not commit the transaction. It should be used for bulk inserts. Unsafe for concurrent use.

type ErrInvalidPayload

type ErrInvalidPayload struct {
	Type      chunk.ChunkType
	ChannelID string
	Reason    string
}

func (*ErrInvalidPayload) Error

func (e *ErrInvalidPayload) Error() string

type Option

type Option func(*options)

func WithVerbose

func WithVerbose(v bool) Option

type SessionInfo

type SessionInfo struct {
	FromTS         *time.Time
	ToTS           *time.Time
	FilesEnabled   bool
	AvatarsEnabled bool
	Mode           string
	Args           string
}

SessionInfo is the information about the session to be logged in the database.

type Source

type Source struct {
	// contains filtered or unexported fields
}

func Open

func Open(ctx context.Context, path string) (*Source, error)

Open attempts to open the database at given path.

func (*Source) AllMessages

func (s *Source) AllMessages(ctx context.Context, channelID string) (iter.Seq2[slack.Message, error], error)

func (*Source) AllThreadMessages

func (s *Source) AllThreadMessages(ctx context.Context, channelID, threadID string) (iter.Seq2[slack.Message, error], error)

func (*Source) ChannelInfo

func (s *Source) ChannelInfo(ctx context.Context, channelID string) (*slack.Channel, error)

func (*Source) Channels

func (s *Source) Channels(ctx context.Context) ([]slack.Channel, error)

Channels returns all channels. If the channel info is not available, it will attempt to get all channels.

func (*Source) Close

func (s *Source) Close() error

Close closes the database connection. It is a noop if the Source was created with [Connect].

func (*Source) Latest

func (s *Source) Latest(ctx context.Context) (map[structures.SlackLink]time.Time, error)

func (*Source) Sessions

func (src *Source) Sessions(ctx context.Context) ([]repository.Session, error)

func (*Source) Sorted

func (s *Source) Sorted(ctx context.Context, channelID string, desc bool, cb func(ts time.Time, msg *slack.Message) error) error

func (*Source) ToChunk

func (src *Source) ToChunk(ctx context.Context, e chunk.Encoder, sessID int64) error

func (*Source) Users

func (s *Source) Users(ctx context.Context) ([]slack.User, error)

func (*Source) WorkspaceInfo

func (s *Source) WorkspaceInfo(ctx context.Context) (*slack.AuthTestResponse, error)

Directories

Path Synopsis
mock_repository
Package mock_repository is a generated GoMock package.
Package mock_repository is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL