core

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithConfig

func WithConfig(config *config.Config) func(*Core)

Optional function to set the config of the Core when creating a new instance.

func WithMsgChan

func WithMsgChan(msgChan *chan common.Msg) func(*Core)

Optional function to set the message channel of the Core when creating a new instance.

Types

type Command added in v0.9.0

type Command = sqlc.Command

type Commands

type Commands []Command

type Core

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

Core is the main struct for the core package.

It contains the config, message channel, commands and projects. The config is used to read and update the configuration. The message channel is used to send messages to the CLI or the app.

func New

func New(options ...func(*Core)) *Core

Create a new Core instance with the given options.

func (*Core) AddCommand

func (c *Core) AddCommand(name string, command string) common.Msg

Add a command with the given name and command string.

func (*Core) AddCommandToProject

func (c *Core) AddCommandToProject(projectName string, commandName string) common.Msg

Add a command to the project with the given name.

func (*Core) AddDomainAlias added in v0.7.0

func (c *Core) AddDomainAlias(projectName string, domainAlias string) common.Msg

Add a domain alias to the given project.

func (*Core) AddProject

func (c *Core) AddProject(name string, port int64, commandNames []string) common.Msg

Add a project with the given name, port and command names.

func (*Core) AddVariable

func (c *Core) AddVariable(projectName string, key string, value string) common.Msg

Add a variable with the given key and value to the project with the given name.

func (*Core) CommandExists added in v0.6.0

func (c *Core) CommandExists(name string) (bool, Command)

Check if a command with the given name exists. Returns the command if it exists.

func (*Core) FetchCommands added in v0.9.0

func (c *Core) FetchCommands() error

func (*Core) FetchProjects added in v0.9.0

func (c *Core) FetchProjects() error

func (*Core) GetCommandNames

func (c *Core) GetCommandNames() []string

Get all the names of the commands.

func (*Core) GetCommands

func (c *Core) GetCommands() ([]Command, error)

Get the commands from the database.

func (*Core) GetConfig added in v0.8.0

func (c *Core) GetConfig() *config.Config

Get the config of the Core instance.

func (*Core) GetProjectById added in v0.15.0

func (c *Core) GetProjectById(id int64) (bool, Project)

func (*Core) GetProjectDir

func (c *Core) GetProjectDir(projectName string) common.Msg

Get the directory for the project with the given name.

func (*Core) GetProjectNames

func (c *Core) GetProjectNames() []string

Get all the names of the projects.

func (*Core) GetProjects

func (c *Core) GetProjects() (Projects, error)

Get the projects from the database.

func (*Core) GetSigChan added in v0.7.2

func (c *Core) GetSigChan() *chan os.Signal

Get the signal channel of the Core instance.

func (*Core) Init

func (c *Core) Init() common.Msg

Initialize the config directory, hosts and nginx.

func (*Core) InitSqliteDB added in v0.9.0

func (c *Core) InitSqliteDB() error

func (*Core) ProjectExists

func (c *Core) ProjectExists(name string) (bool, Project)

Check if a project with the given name exists. Returns the project if it exists.

func (*Core) RemoveCommand

func (c *Core) RemoveCommand(name string) common.Msg

Remove the command with the given name.

func (*Core) RemoveCommandById added in v0.15.0

func (c *Core) RemoveCommandById(id int64) common.Msg

func (*Core) RemoveCommandFromProject

func (c *Core) RemoveCommandFromProject(projectName string, commandName string) common.Msg

Remove the command with the given commandName from the project with the given projectName.

func (*Core) RemoveDomainAlias added in v0.7.0

func (c *Core) RemoveDomainAlias(projectName string, domainAlias string) common.Msg

Remove a domain alias from the given project.

func (*Core) RemoveProject

func (c *Core) RemoveProject(name string) common.Msg

Remove the project with the given name.

func (*Core) RemoveProjectById added in v0.15.0

func (c *Core) RemoveProjectById(projectID int64) common.Msg

func (*Core) RemoveVariable

func (c *Core) RemoveVariable(projectName string, key string) common.Msg

Remove the variable with the given key from the project with the given name.

func (*Core) RenameCommand added in v0.6.0

func (c *Core) RenameCommand(oldName string, newName string) common.Msg

Rename the command with the given old name to the given new name.

func (*Core) RenameProject added in v0.6.0

func (c *Core) RenameProject(oldName string, newName string) common.Msg

Rename the project with the given old name to the given new name.

func (*Core) SetErr added in v0.8.0

func (c *Core) SetErr(err io.Writer)

func (*Core) SetOut added in v0.8.0

func (c *Core) SetOut(out io.Writer)

func (*Core) SetProjectDir

func (c *Core) SetProjectDir(projectName string, dir *string) common.Msg

Set the directory for the project with the given name.

func (*Core) TryToRun

func (c *Core) TryToRun(name string) common.Msg

Try to run a project with the given name.

func (*Core) UpdateCommand added in v0.6.0

func (c *Core) UpdateCommand(name string, command string) common.Msg

Update the command with the given name to the given command string.

func (*Core) UpdateCommandById added in v0.15.0

func (c *Core) UpdateCommandById(id int64, name string, command string) common.Msg

func (*Core) UpdateProject added in v0.6.0

func (c *Core) UpdateProject(name string, port int64, commandNames []string) common.Msg

Update the project with the given name to the given port and command names.

func (*Core) UpdateProjectByID added in v0.15.0

func (c *Core) UpdateProjectByID(projectID int64, name string, port int64, commandNames []string) common.Msg

type DomainAlias added in v0.9.0

type DomainAlias = sqlc.DomainAlias

type Project

type Project struct {
	sqlc.Project
	Commands      []Command
	Variables     []Variable
	DomainAliases []DomainAlias
}

Project is a struct that represents a project and its linked structs.

type Projects

type Projects []Project

Projects is a map of project names to their Projects.

type Variable added in v0.9.0

type Variable = sqlc.Variable

Jump to

Keyboard shortcuts

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