base

package
v0.0.0-...-2f69930 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseConfig

type BaseConfig struct {
	MaxUploadFileSize            int64           `json:"max_file_size"`
	DefaultDeleteDuration        config.Duration `json:"default_delete_duration"`
	DefaultLoginDeleteDuration   config.Duration `json:"default_login_delete_duration"`
	DefaultAuthDeleteDuration    config.Duration `json:"default_auth_delete_duration"`
	DefaultOperateDeleteDuration config.Duration `json:"default_operate_delete_duration"`
	LogLoginPath                 []string        `json:"log_login_path"`
	LogAuthPath                  []string        `json:"log_auth_path"`
	LogFilePath                  []string        `json:"log_file_path"`
	LogOperateExcludePath        []string        `json:"log_operate_exclude_path"`
}

type CacheConfig

type CacheConfig struct {
	CacheDefaultExpiration config.Duration `json:"cache_default_expiration"`
	CacheCleanupInterval   config.Duration `json:"cache_cleanup_interval"`
}

type Config

type Config struct {
	MongodbConfig
	CacheConfig
	BaseConfig
}

type MongodbConfig

type MongodbConfig struct {
	MongoDNS          string `json:"mongo_dns"`
	MongoDatabaseName string `json:"mongo_database_name"`
}

type Service

type Service struct {
	*Config
	*cache.Cache
	M mongodb.Mongoer
}

func NewService

func NewService(c *Config, cc *cache.Cache, m mongodb.Mongoer) *Service

func (*Service) GetRequestAllIP

func (self *Service) GetRequestAllIP(r *http.Request) (ip string)

func (*Service) GetRequestIP

func (self *Service) GetRequestIP(r *http.Request) (ip string)

func (*Service) GetRequestPayload

func (self *Service) GetRequestPayload(r *http.Request) (payload string)

func (*Service) LogRequest

func (self *Service) LogRequest(r *http.Request, typ string, deleteDuration time.Duration) primitive.ObjectID

func (*Service) LogRequestAuth

func (self *Service) LogRequestAuth(r *http.Request) primitive.ObjectID

func (*Service) LogRequestLogin

func (self *Service) LogRequestLogin(r *http.Request) primitive.ObjectID

func (*Service) LogRequestOperate

func (self *Service) LogRequestOperate(r *http.Request) primitive.ObjectID

func (*Service) LogResponse

func (self *Service) LogResponse(rw http.ResponseWriter, r *http.Request)

func (*Service) LogResponseAuth

func (self *Service) LogResponseAuth(rw http.ResponseWriter, r *http.Request)

func (*Service) LogResponseLogin

func (self *Service) LogResponseLogin(rw http.ResponseWriter, r *http.Request)

func (*Service) LogResponseOperate

func (self *Service) LogResponseOperate(rw http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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