Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
pieceowater committed Sep 29, 2024
1 parent 4c1eda4 commit 219d9c4
Showing 1 changed file with 10 additions and 50 deletions.
60 changes: 10 additions & 50 deletions gossiper.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
// Env is an alias for the environment.Env
type Env = environment.Env

// EnvVars is an pointer alias for the &environment.EnvVars
// EnvVars is a pointer alias for the &environment.EnvVars
var EnvVars = &environment.EnvVars

// NETWORK
Expand Down Expand Up @@ -41,69 +41,29 @@ type AMQPConsumerConfig = config.AMQPConsumerConfig
// AMQPConsumeConfig is an alias for the config.AMQPConsumeConfig
type AMQPConsumeConfig = config.AMQPConsumeConfig

//TOOLS
// TOOLS

// Tools is an alias for the tools.Tools
type Tools = tools.Tools

// Satisfies is an alias for the Tools.Satisfies method.
func Satisfies(data any, dest any) error {
inst := Tools{}
return inst.Satisfies(data, dest)
}

// LogAction is an alias for the Tools.LogAction method.
func LogAction(action string, data any) {
inst := Tools{}
inst.LogAction(action, data)
}

// NewServiceError is an alias for the Tools.NewServiceError method.
func NewServiceError(message string) *tools.ServiceError {
return tools.NewServiceError(message)
}

// DefaultFilter is an alias for the Tools.DefaultFilter method.
type DefaultFilter[T any] struct {
tools.DefaultFilter[T]
}

// PaginatedEntity is a wrapper for tools.PaginatedEntity
type PaginatedEntity[T any] struct {
tools.PaginatedEntity[T]
}

// NewFilter creates a new DefaultFilter instance.
func NewFilter[T any]() tools.DefaultFilter[T] {
return tools.NewDefaultFilter[T]()
}

// Enum with aliases for predefined pagination page length
const (
TEN = tools.TEN
FIFTEEN = tools.FIFTEEN
TWENTY = tools.TWENTY
TWENTY_FIVE = tools.TWENTY_FIVE
THIRTY = tools.THIRTY
THIRTY_FIVE = tools.THIRTY_FIVE
FORTY = tools.FORTY
FORTY_FIVE = tools.FORTY_FIVE
FIFTY = tools.FIFTY
FIFTY_FIVE = tools.FIFTY_FIVE
SIXTY = tools.SIXTY
SIXTY_FIVE = tools.SIXTY_FIVE
SEVENTY = tools.SEVENTY
SEVENTY_FIVE = tools.SEVENTY_FIVE
EIGHTY = tools.EIGHTY
EIGHTY_FIVE = tools.EIGHTY_FIVE
NINETY = tools.NINETY
NINETY_FIVE = tools.NINETY_FIVE
ONE_HUNDRED = tools.ONE_HUNDRED
)

// PaginatedEntity is an alias for the tools.PaginatedEntity.
type PaginatedEntity[T any] struct {
tools.PaginatedEntity[T]
}

// ToPaginated directly uses tools.PaginatedEntity
func ToPaginated[T any](items []T, count int) tools.PaginatedEntity[T] {
return tools.ToPaginated[T](items, count)
// ToPaginated PaginatedEntity directly uses tools.PaginatedEntity
func ToPaginated[T any](items []T, count int) PaginatedEntity[T] {
return PaginatedEntity[T]{tools.ToPaginated[T](items, count)}
}

// BOOTSTRAP
Expand Down

0 comments on commit 219d9c4

Please sign in to comment.