service

package
v0.0.0-...-9d05754 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	App = &Service{}
)

Functions

func StartHttpService

func StartHttpService() error

func StartService

func StartService() error

Types

type ClientConfig

type ClientConfig struct {
	UserServiceName string `yaml:"userServiceName" json:"userServiceName"`
}

type Config

type Config struct {
	Log        *LogConfig        `yaml:"log" json:"log"`
	Etcd       *EtcdConfig       `yaml:"etcd" json:"etcd"`
	Server     *ServerConfig     `yaml:"server" json:"server"`
	HttpServer *HttpServerConfig `yaml:"httpServer" json:"httpServer"`
	Database   *DatabaseConfig   `yaml:"database" json:"database"`
	Client     *ClientConfig     `yaml:"client" json:"client"`
	Redis      *RedisConfig      `yaml:"redis" json:"redis"`
	Mongo      *MongoConfig      `yaml:"mongo" json:"mongo"`
}

type DatabaseConfig

type DatabaseConfig struct {
	Address    string `yaml:"address" json:"address"`
	Username   string `yaml:"username" json:"username"`
	Password   string `yaml:"password" json:"password"`
	DriverName string `yaml:"driverName" json:"driverName"`
	DbName     string `yaml:"dbName" json:"dbName"`
}

type EtcdConfig

type EtcdConfig struct {
	Endpoints []string `yaml:"endpoints" json:"endpoints"`
}

type HandlerServiceFunc

type HandlerServiceFunc func([]byte) ([]byte, error)

type HttpServer

type HttpServer struct {
	ServiceName string
	Port        string
}

func (*HttpServer) StartHttpServer

func (h *HttpServer) StartHttpServer(httpService *HttpService)

type HttpServerConfig

type HttpServerConfig struct {
	Port string `yaml:"port" json:"port"`
}

type HttpService

type HttpService struct {
	ServiceApp *Service
}

func (*HttpService) AddGoods

func (h *HttpService) AddGoods(reqData []byte) (interface{}, error)

func (*HttpService) DeductStock

func (h *HttpService) DeductStock(reqData []byte) (interface{}, error)

func (*HttpService) DelGoods

func (h *HttpService) DelGoods(reqData []byte) (interface{}, error)

func (*HttpService) GetGoods

func (h *HttpService) GetGoods(reqData []byte) (interface{}, error)

func (*HttpService) GetGoodsListByCategory

func (h *HttpService) GetGoodsListByCategory(reqData []byte) (interface{}, error)

func (*HttpService) ModifyGoodsInfo

func (h *HttpService) ModifyGoodsInfo(reqData []byte) (interface{}, error)

type LogConfig

type LogConfig struct {
	LogPath  string `yaml:"logPath" json:"logPath"`
	LogLevel string `yaml:"logLevel" json:"logLevel"`
}

type MongoConfig

type MongoConfig struct {
	Address  string `yaml:"address" json:"address"`
	Username string `yaml:"username" json:"username"`
	Password string `yaml:"password" json:"password"`
	DbName   string `yaml:"dbName" json:"dbName"`
}

type RedisConfig

type RedisConfig struct {
	Address          string `yaml:"address" json:"address"`
	Password         string `yaml:"password" json:"password"`
	RedisLockTimeout int64  `yaml:"redisLockTimeout" json:"redisLockTimeout"`
}

type ServerConfig

type ServerConfig struct {
	Name string `yaml:"name" json:"name"`
	Port string `yaml:"port" json:"port"`
}

type Service

type Service struct {
	Config *Config

	RedisPool *redis.RedisPool
	Mongo     *mongo.Client
	// contains filtered or unexported fields
}

func (*Service) AddGoods

func (*Service) AddGoodsIntoMgo

func (s *Service) AddGoodsIntoMgo(ctx context.Context, goods *model.GoogsModel) error

func (*Service) DeductStock

func (*Service) DelGoods

func (*Service) GetGoods

func (*Service) ModifyGoodsInfo

Jump to

Keyboard shortcuts

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