migration

package
v0.20.3 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: AGPL-3.0 Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoPost added in v0.16.0

func DoPost(url string, form url.Values) (resp *http.Response, err error)

DoPost makes a form encoded post request

func DoPostWithHeaders added in v0.20.2

func DoPostWithHeaders(url string, form url.Values, headers map[string]string) (resp *http.Response, err error)

DoPostWithHeaders does an api request and allows to pass in arbitrary headers

func DownloadFile added in v0.16.0

func DownloadFile(url string) (buf *bytes.Buffer, err error)

DownloadFile downloads a file and returns its contents

func DownloadFileWithHeaders added in v0.19.0

func DownloadFileWithHeaders(url string, headers http.Header) (buf *bytes.Buffer, err error)

DownloadFileWithHeaders downloads a file and allows you to pass in headers

func GetTables

func GetTables() []interface{}

GetTables returns all structs which are also a table.

func InitDB

func InitDB() (err error)

InitDB sets up the database connection to use in this module

func InsertFromStructure

func InsertFromStructure(str []*models.NamespaceWithListsAndTasks, user *user.User) (err error)

InsertFromStructure takes a fully nested Vikunja data structure and a user and then creates everything for this user (Namespaces, tasks, etc. Even attachments and relations.)

func SetMigrationStatus

func SetMigrationStatus(m MigratorName, u *user.User) (err error)

SetMigrationStatus sets the migration status for a user

Types

type FileMigrator added in v0.18.0

type FileMigrator interface {
	MigratorName
	// Migrate is the interface used to migrate a user's tasks, list and other things from a file to vikunja.
	// The user object is the user who's tasks will be migrated.
	Migrate(user *user.User, file io.ReaderAt, size int64) error
}

FileMigrator handles importing Vikunja data from a file. The implementation of it determines the format.

type Migrator

type Migrator interface {
	MigratorName
	// Migrate is the interface used to migrate a user's tasks from another platform to vikunja.
	// The user object is the user who's tasks will be migrated.
	Migrate(user *user.User) error
	// AuthURL returns a url for clients to authenticate against.
	// The use case for this are Oauth flows, where the server token should remain hidden and not
	// known to the frontend.
	AuthURL() string
}

Migrator is the basic migrator interface which is shared among all migrators

type MigratorName added in v0.18.0

type MigratorName interface {
	// Name holds the name of the migration.
	// This is used to show the name to users and to keep track of users who already migrated.
	Name() string
}

type Status

type Status struct {
	ID           int64     `xorm:"bigint autoincr not null unique pk" json:"id"`
	UserID       int64     `xorm:"bigint not null" json:"-"`
	MigratorName string    `xorm:"varchar(255)" json:"migrator_name"`
	Created      time.Time `xorm:"created not null 'created'" json:"time"`
}

Status represents this migration status

func GetMigrationStatus

func GetMigrationStatus(m MigratorName, u *user.User) (status *Status, err error)

GetMigrationStatus returns the migration status for a migration and a user

func (*Status) TableName

func (s *Status) TableName() string

TableName holds the table name for the migration status table

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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