compose

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

package compose is a wrapper around the docker compose cli. it provides a programmatic interface for managing docker compose projects. it is not a complete 1:1 mapping of the docker compose cli, but provides a programmatic interface for managing docker compose projects in Go, making it useful for automation, tooling, or embedding docker compose behavior.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrComposeError     = fmt.Errorf("compose error")
	ErrComposeFlagError = fmt.Errorf("compose flag error")
	ErrComposeUpError   = fmt.Errorf("compose up error")
	ErrComposeDownError = fmt.Errorf("compose down error")
	ErrComposeLogsError = fmt.Errorf("compose logs error")
)

Functions

func IsComposeDownError

func IsComposeDownError(err error) bool

func IsComposeError

func IsComposeError(err error) bool

func IsComposeFlagError

func IsComposeFlagError(err error) bool

func IsComposeLogsError

func IsComposeLogsError(err error) bool

func IsComposeUpError

func IsComposeUpError(err error) bool

func NewCompose

func NewCompose(project *create.Project) *compose

Types

type ComposeDownError

type ComposeDownError struct {
	Message string
}

ComposeDownError is the error for the compose down command

func NewComposeDownError

func NewComposeDownError(err error) *ComposeDownError

func (*ComposeDownError) Error

func (e *ComposeDownError) Error() string

func (*ComposeDownError) Unwrap

func (e *ComposeDownError) Unwrap() error

type ComposeDownOptions

type ComposeDownOptions struct {
	RemoveOrphans bool
	Timeout       *int
	RemoveImage   *string
	RemoveVolumes bool

	Flags  []string
	Writer io.Writer
}

ComposeDownOptions is the options for the compose down command

func (*ComposeDownOptions) GenerateFlags

func (opt *ComposeDownOptions) GenerateFlags() ([]string, error)

type ComposeError

type ComposeError struct {
	Message string
}

ComposeError is the error for the compose command

func NewComposeError

func NewComposeError(err error) *ComposeError

func (*ComposeError) Error

func (e *ComposeError) Error() string

func (*ComposeError) Unwrap

func (e *ComposeError) Unwrap() error

type ComposeFlagError

type ComposeFlagError struct {
	Flag    string
	Message string
}

ComposeFlagError is the error for the compose flag

func NewComposeFlagError

func NewComposeFlagError(flag, message string) *ComposeFlagError

func (*ComposeFlagError) Error

func (e *ComposeFlagError) Error() string

func (*ComposeFlagError) Unwrap

func (e *ComposeFlagError) Unwrap() error

type ComposeLogsError

type ComposeLogsError struct {
	Message string
}

ComposeLogsError is the error for the compose logs command

func NewComposeLogsError

func NewComposeLogsError(err error) *ComposeLogsError

func (*ComposeLogsError) Error

func (e *ComposeLogsError) Error() string

func (*ComposeLogsError) Unwrap

func (e *ComposeLogsError) Unwrap() error

type ComposeLogsOptions

type ComposeLogsOptions struct {
	Tail        *int
	Follow      bool
	NoLogPrefix bool

	Writer io.Writer
	Flags  []string
}

ComposeLogsOptions is the options for the compose logs command

func (*ComposeLogsOptions) GenerateFlags

func (opt *ComposeLogsOptions) GenerateFlags() ([]string, error)

type ComposeUpError

type ComposeUpError struct {
	Message string
}

ComposeUpError is the error for the compose up command

func NewComposeUpError

func NewComposeUpError(err error) *ComposeUpError

func (*ComposeUpError) Error

func (e *ComposeUpError) Error() string

func (*ComposeUpError) Unwrap

func (e *ComposeUpError) Unwrap() error

type ComposeUpOptions

type ComposeUpOptions struct {
	Detach                  bool
	AbortOnContainerExit    bool
	AbortOnContainerFailure bool
	AlwaysRecreateDeps      bool
	Attach                  *string
	AttachDependencies      bool
	Build                   bool
	NoBuild                 bool
	ForceRecreate           bool
	Menu                    bool
	ExitCodeFrom            *string
	NoAttach                *string
	NoColor                 bool
	NoDeps                  bool
	NoLogPrefix             bool
	NoRecreate              bool
	Pull                    *string
	NoStart                 bool
	QuietPull               bool
	RemoveOrphans           bool
	RenewAnonVolumes        bool
	Scale                   []ComposeUpScale
	Timeout                 *int
	Timestamps              bool
	Wait                    bool
	WaitTimeout             *int
	Watch                   bool
	Yes                     bool

	Flags  []string
	Writer io.Writer
	Errs   []error
}

ComposeUpOptions is the options for the compose up command

func (*ComposeUpOptions) GenerateFlags

func (opt *ComposeUpOptions) GenerateFlags() ([]string, error)

GenerateFlags generates the flags for the compose up command

It will return a slice of flags to append to the command Eg.

[]string{"up", "--detach", ...}

type ComposeUpScale

type ComposeUpScale struct {
	Service string
	Num     int
}

ComposeUpScale is the scale for the compose up command

type SetComposeDownOption

type SetComposeDownOption func(*ComposeDownOptions) error

SetComposeDownOption is a function that sets a ComposeDownOptions

type SetComposeLogsOption

type SetComposeLogsOption func(*ComposeLogsOptions) error

SetComposeLogsOption is a function that sets a ComposeLogsOptions

type SetComposeUpOption

type SetComposeUpOption func(*ComposeUpOptions) error

SetComposeUpOption is a function that sets a ComposeUpOptions

Directories

Path Synopsis
options
down
Package down is the package for the compose down options
Package down is the package for the compose down options
logs
Package logs is the package for the compose logs options
Package logs is the package for the compose logs options
up
Package up provides options for the compose up command
Package up provides options for the compose up command

Jump to

Keyboard shortcuts

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