go_package_manager

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

README

Go Package Management

This is tool content setup library and config for service golang

Maintain from Go SDK 200 Lab

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppFlatSet

type AppFlatSet struct {
	*flag.FlagSet
}

func (*AppFlatSet) GetSampleEnvs

func (f *AppFlatSet) GetSampleEnvs()

func (*AppFlatSet) Parse

func (f *AppFlatSet) Parse(args []string)

type Function

type Function func(ctx ServiceContext) error

type HashPrefix

type HashPrefix interface {
	GetPrefix() string
	Get() interface{}
}

type HttpServer

type HttpServer interface {
	Runnable
	// AddHandler - Add handlers to GIN Server
	AddHandler(HttpServerHandler)
	// URI - That the server is listening
	URI() string
}

type HttpServerHandler

type HttpServerHandler = func(*gin.Engine)

type Option

type Option func(*service)

type PrefixRunnable

type PrefixRunnable interface {
	HashPrefix
	Runnable
}

type Runnable

type Runnable interface {
	Name() string
	InitFlags()
	Configure() error
	Run() error
	Stop() <-chan bool
}

type Service

type Service interface {
	// ServiceContext - A part of Service, it's passed to all handlers/functions
	ServiceContext
	// Name of the service
	Name()
	// Version of the service
	Version()
	// HttpServer - Gin HTTP Server wrapper
	HttpServer() HttpServer
	// Init with options, they can be db connections or
	// anything the service need handle before starting
	Init() error
	// IsRegistered - This method returns service if it is registered on discovery
	IsRegistered() bool
	// Start service and it's all component.
	// It will be stopped if any service return error
	Start() error
	// Stop service and it's all component.
	Stop()
	// OutEnv - Method export all flags to std/terminal
	// We might use: "> .env" to move its content .env file
	OutEnv()
}

Service Interface -The heart of SDK, Service represents for a real micro service with its all components

type ServiceContext

type ServiceContext interface {
	// Logger for a specific service, usually it has a prefix to distinguish
	// with each others
	Logger(prefix string) logger.Logger
	// Get component with prefix
	Get(prefix string) (interface{}, bool)
	MustGet(prefix string) interface{}
	Env() string
}

type Storage

type Storage interface {
	Get(prefix string) (interface{}, error)
	MustGet(prefix string) interface{}
}

Directories

Path Synopsis
plugins

Jump to

Keyboard shortcuts

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