convert

package
v3.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package convert implements conversions between different Slackdump formats.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyChunk    = errors.New("missing chunk")
	ErrNoLocFunction = errors.New("missing location function")
)

Functions

This section is empty.

Types

type C2EOption

type C2EOption func(*ChunkToExport)

func WithIncludeAvatars added in v3.0.4

func WithIncludeAvatars(b bool) C2EOption

WithIncludeAvatars sets the IncludeAvataars option.

func WithIncludeFiles

func WithIncludeFiles(b bool) C2EOption

WithIncludeFiles sets the IncludeFiles option.

func WithLogger

func WithLogger(lg *slog.Logger) C2EOption

WithLogger sets the logger.

func WithSrcFileLoc

func WithSrcFileLoc(fn func(*slack.Channel, *slack.File) string) C2EOption

WithSrcFileLoc sets the SrcFileLoc function.

func WithTrgFileLoc

func WithTrgFileLoc(fn func(*slack.Channel, *slack.File) string) C2EOption

WithTrgFileLoc sets the TrgFileLoc function.

type ChunkToExport

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

ChunkToExport is a converter between Chunk and Export formats. Zero value is not usable.

func NewChunkToExport

func NewChunkToExport(src *chunk.Directory, trg fsadapter.FS, opt ...C2EOption) *ChunkToExport

func (*ChunkToExport) Convert

func (c *ChunkToExport) Convert(ctx context.Context) error

Convert converts the chunk directory contents to the export format. It validates the input parameters.

Restrictions

TODO: Currently, one chunk file per channel is supported. If there are multiple chunk files per channel, the behaviour is undefined, but I expect it to overwrite the previous files.

func (*ChunkToExport) Validate

func (c *ChunkToExport) Validate() error

Validate validates the input parameters.

Jump to

Keyboard shortcuts

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