core

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Buffer

func Buffer() *bytes.Buffer

Buffer -

func NewLogger

func NewLogger(level, encode string) (*zap.Logger, error)

NewLogger -

func PutBuffer

func PutBuffer(b *bytes.Buffer)

PutBuffer -

Types

type Backend

type Backend interface {
	Put(*PutInput) (*PutOutput, error)
	Fetch(*FetchInput) (*FetchOutput, error)
	Remove(*RemoveInput) (*RemoveOutput, error)
}

Backend -

type Confirmer

type Confirmer interface {
	Confirm(operation string, resources Resources) (bool, error)
}

Confirmer have responsibility to handle user operation confirmation.

type Context

type Context struct {
	Log      *zap.Logger
	Validate *validator.Validate
	Ctx      context.Context
	// contains filtered or unexported fields
}

Context -

func NewContext

func NewContext(background context.Context, log *zap.Logger, v *validator.Validate) *Context

NewContext -

func (*Context) Cancel

func (c *Context) Cancel()

Cancel -

type ErrCode

type ErrCode int

ErrCode -

const (
	OK ErrCode = iota
	InvalidParam
	Conflict
	Timeout
	Internal
	External
	NotFound
	Unauthorized
	Unauthenticated
	RateLimit
	NotImplementedYet
	Canceled
	Undefined
)

func ErrorCode

func ErrorCode(err error) ErrCode

ErrorCode -

func (ErrCode) String

func (i ErrCode) String() string

type Error

type Error interface {
	Code() ErrCode
	error
}

Error -

func NewError

func NewError(code ErrCode, msg string) Error

NewError -

func NotImplementedError

func NotImplementedError(msg string) Error

NotImplementedError -

func Validate

func Validate(input interface{}, v *validator.Validate) Error

Validate -

func WrapError

func WrapError(code ErrCode, msg string, err error) Error

WrapError -

type FetchInput

type FetchInput struct {
	Recursive bool
	Regexp    string
	Src       string
}

FetchInput -

type FetchOutput

type FetchOutput struct {
	Resources Resources
}

FetchOutput -

type LoggerConfig

type LoggerConfig struct {
	LoggingLevel  LoggingLevel
	LoggingEncode LoggingEncode
	Out           io.Writer
	NoTimestamp   bool
	// contains filtered or unexported fields
}

LoggerConfig store logging configurations

type LoggingEncode

type LoggingEncode string

LoggingEncode -

const (
	// LoggingEncJSON -
	LoggingEncJSON LoggingEncode = "json"
	// LoggingEncText -
	LoggingEncText LoggingEncode = "text"
	// LoggingEncColorText -
	LoggingEncColorText LoggingEncode = "color"
)

type LoggingLevel

type LoggingLevel int

LoggingLevel はloggingのsuppressするlevelを表します. 指定されたlevel未満のlogは出力されません.

const (
	// LoggingLvlDebug -
	LoggingLvlDebug LoggingLevel = iota - 1
	// LoggingLvlInfo -
	LoggingLvlInfo
	// LoggingLvlWarn -
	LoggingLvlWarn
	// LoggingLvlError -
	LoggingLvlError
)

type PutInput

type PutInput struct {
	Dryrun    bool
	CreateDir bool
	Recursive bool
	Dest      string
	Resources Resources
}

PutInput -

type PutOutput

type PutOutput struct {
	PutNum int
}

PutOutput -

type RemoveInput

type RemoveInput struct{}

RemoveInput -

type RemoveOutput

type RemoveOutput struct{}

RemoveOutput -

type Resource

type Resource interface {
	Type() ResourceType
	URI() string
	Open() (io.ReadCloser, error)
}

Resource -

type ResourceType

type ResourceType int

ResourceType -

const (
	InvalidResource ResourceType = iota
	S3Resource
	LocalFileResource
)

func InspectPath

func InspectPath(path string) ResourceType

NOTE: not sure which layer should have resource type decision responsibility. InspectPath return corresponding resource type.

func (ResourceType) IsLocal

func (rt ResourceType) IsLocal() bool

IsLocal -

func (ResourceType) IsRemote

func (rt ResourceType) IsRemote() bool

IsRemote -

func (ResourceType) String

func (i ResourceType) String() string

type Resources

type Resources []Resource

Resources -

Jump to

Keyboard shortcuts

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