service

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddCardInput

type AddCardInput struct {
	BoardName    string
	Title        string
	Description  string
	Column       string
	Parent       string
	Creator      string
	CustomFields map[string]string // custom fields to set (parsed from key=value)
}

AddCardInput contains the input for adding a card.

type AliasService

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

AliasService handles alias generation and collision detection.

func NewAliasService

func NewAliasService(cardStore store.CardStore) *AliasService

NewAliasService creates a new alias service.

func (*AliasService) GenerateAlias

func (s *AliasService) GenerateAlias(boardName, title string) (string, error)

GenerateAlias creates a unique alias from a title. If the base alias is taken, appends -2, -3, etc.

func (*AliasService) IsAliasAvailable

func (s *AliasService) IsAliasAvailable(boardName, alias string) bool

IsAliasAvailable returns true if the alias is not in use.

type BoardMigration added in v0.3.0

type BoardMigration struct {
	BoardName      string
	ConfigPath     string
	NeedsMigration bool
	FromSchema     string // empty if missing
	ToSchema       string
	Cards          []CardMigration
}

BoardMigration describes changes to a board.

type BoardService

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

BoardService handles board operations.

func NewBoardService

func NewBoardService(boardStore store.BoardStore, cardStore store.CardStore) *BoardService

NewBoardService creates a new board service.

func (*BoardService) AddColumn added in v0.5.0

func (s *BoardService) AddColumn(boardName, columnName, color string, position int) error

AddColumn adds a new column to a board. If color is empty, auto-assigns from the color palette. If position is -1, appends to end.

func (*BoardService) Create

func (s *BoardService) Create(name string) error

Create creates a new board with default columns.

func (*BoardService) DeleteColumn added in v0.5.0

func (s *BoardService) DeleteColumn(boardName, columnName string) (int, error)

DeleteColumn removes a column and all its cards. Returns the number of cards deleted.

func (*BoardService) Exists

func (s *BoardService) Exists(name string) bool

Exists returns true if the board exists.

func (*BoardService) Get

func (s *BoardService) Get(name string) (*model.BoardConfig, error)

Get returns the board configuration.

func (*BoardService) GetColumnCardCount added in v0.5.0

func (s *BoardService) GetColumnCardCount(boardName, columnName string) (int, error)

GetColumnCardCount returns the number of cards in a column.

func (*BoardService) List

func (s *BoardService) List() ([]string, error)

List returns the names of all boards.

func (*BoardService) RenameColumn added in v0.5.0

func (s *BoardService) RenameColumn(boardName, oldName, newName string) error

RenameColumn renames a column. Also updates default_column if it referenced the old name.

func (*BoardService) ReorderColumn added in v0.5.0

func (s *BoardService) ReorderColumn(boardName, columnName string, newPosition int) error

ReorderColumn moves a column to a new position (0-indexed).

func (*BoardService) ReorderColumns added in v0.5.0

func (s *BoardService) ReorderColumns(boardName string, columnNames []string) error

ReorderColumns reorders all columns according to the provided order. The columnNames slice must contain exactly the same column names as exist in the board.

func (*BoardService) UpdateColumnColor added in v0.5.0

func (s *BoardService) UpdateColumnColor(boardName, columnName, color string) error

UpdateColumnColor updates a column's color.

type CardMigration added in v0.3.0

type CardMigration struct {
	CardID       string
	Path         string
	FromVersion  int // 0 if missing
	ToVersion    int
	RemoveColumn bool
}

CardMigration describes changes to a card.

type CardService

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

CardService handles card operations.

func NewCardService

func NewCardService(cardStore store.CardStore, boardStore store.BoardStore, aliasService *AliasService) *CardService

NewCardService creates a new card service.

func (*CardService) Add

func (s *CardService) Add(input AddCardInput) (*model.Card, error)

Add creates a new card.

func (*CardService) Delete

func (s *CardService) Delete(boardName, cardID string) error

Delete removes a card from the board.

func (*CardService) Edit added in v0.3.0

func (s *CardService) Edit(input EditCardInput) (*model.Card, error)

Edit applies changes specified in the input to an existing card.

func (*CardService) FindByIDOrAlias

func (s *CardService) FindByIDOrAlias(boardName, idOrAlias string) (*model.Card, error)

FindByIDOrAlias finds a card by ID or alias.

func (*CardService) Get

func (s *CardService) Get(boardName, cardID string) (*model.Card, error)

Get retrieves a card by ID.

func (*CardService) List

func (s *CardService) List(boardName string, columnFilter string) ([]*model.Card, error)

List returns all cards for a board, optionally filtered by column. Cards are returned in the order specified by the board's column card_ids.

func (*CardService) MoveCard

func (s *CardService) MoveCard(boardName, cardID, targetColumn string) error

MoveCard moves a card to a different column at the end.

func (*CardService) MoveCardAt

func (s *CardService) MoveCardAt(boardName, cardID, targetColumn string, position int) error

MoveCardAt moves a card to a different column at a specific position. If position is -1, appends to end.

func (*CardService) Update

func (s *CardService) Update(boardName string, card *model.Card) error

Update saves changes to a card.

func (*CardService) UpdateTitle

func (s *CardService) UpdateTitle(boardName string, card *model.Card, newTitle string) error

UpdateTitle updates the card title and regenerates alias if not explicit.

type EditCardInput added in v0.3.0

type EditCardInput struct {
	BoardName     string
	CardIDOrAlias string
	Title         *string           // nil = no change
	Description   *string           // nil = no change
	Column        *string           // nil = no change
	Parent        *string           // nil = no change, empty string = clear parent
	Alias         *string           // nil = no change
	CustomFields  map[string]string // fields to set/update (parsed from key=value)
}

EditCardInput contains the input for editing a card. Pointer fields indicate "set this field"; nil means "don't change".

type GlobalMigration added in v0.3.0

type GlobalMigration struct {
	Path           string
	NeedsMigration bool
	FromSchema     string // empty if missing
	ToSchema       string
}

GlobalMigration describes changes to the global config.

type InitService

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

InitService handles project initialization.

func NewInitService

func NewInitService(globalStore store.GlobalStore) *InitService

NewInitService creates a new init service.

func (*InitService) Initialize

func (s *InitService) Initialize(customLocation, boardName string, customColumns []string) error

Initialize initializes Kan in the current directory. If customLocation is empty, uses the default .kan directory. If boardName is empty, uses "main". If customColumns is empty, uses default columns.

type MigrateService added in v0.3.0

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

MigrateService handles schema migrations for Kan data files. Uses raw file I/O to bypass store validation.

func NewMigrateService added in v0.3.0

func NewMigrateService(paths *config.Paths) *MigrateService

NewMigrateService creates a new migration service.

func (*MigrateService) Execute added in v0.3.0

func (s *MigrateService) Execute(plan *MigrationPlan, dryRun bool) error

Execute performs the migration.

func (*MigrateService) Plan added in v0.3.0

func (s *MigrateService) Plan() (*MigrationPlan, error)

Plan analyzes the current state and returns a migration plan.

type MigrationPlan added in v0.3.0

type MigrationPlan struct {
	GlobalConfig *GlobalMigration
	Boards       []BoardMigration
}

MigrationPlan describes what changes would be made during migration.

func (*MigrationPlan) HasChanges added in v0.3.0

func (p *MigrationPlan) HasChanges() bool

HasChanges returns true if the plan has any migrations to perform.

Jump to

Keyboard shortcuts

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