contracts

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	Get(key string) []byte
	GetBind(key string, bindPtr any) error
	Set(key string, value []byte, expire time.Duration) error
	SetBind(key string, bindPtr any, expire time.Duration) error
	Delete(key string) error
}

type Config

type Config interface {
	Get(string) string
	GetString(key string) string
	GetInt(key string) int
	GetBool(key string) bool
	GetStringSlice(key string) []string
	GetIntSlice(key string) []int
	GetBoolSlice(key string) []bool

	GetOrDefaultString(key string, defaultValue string) string
	GetOrDefaultInt(key string, defaultValue int) int
	GetOrDefaultBool(key string, defaultValue bool) bool
}

type CronJob

type CronJob interface {
	DefineJob(definition gocron.JobDefinition, handler func()) error
}

type EmailSender

type EmailSender interface {
	To(t *[]*mail.Address) EmailSender
	Bcc(b *[]*mail.Address) EmailSender
	Cc(c *[]*mail.Address) EmailSender
	Subject(sub string) EmailSender
	HTML(html string) EmailSender
	Text(text string) EmailSender
	Headers(h map[string]string) EmailSender
	Attachments(a map[string]string) EmailSender
	Send(useQueue ...bool) error
}

type GoeFiber

type GoeFiber interface {
	App() *fiber.App
	CreateFiberApp(appName ...string) *fiber.App
}

type Logger

type Logger interface {
	Debug(args ...any)
	Log(args ...any)
	Info(args ...any)
	Warn(args ...any)
	Error(args ...any)
	Fatal(args ...any)
	Panic(args ...any)

	Debugf(format string, args ...any)
	Logf(format string, args ...any)
	Infof(format string, args ...any)
	Warnf(format string, args ...any)
	Errorf(format string, args ...any)
	Fatalf(format string, args ...any)
	Panicf(format string, args ...any)

	Debugw(msg string, keysAndValues ...any)
	Infow(msg string, keysAndValues ...any)
	Warnw(msg string, keysAndValues ...any)
	Errorw(msg string, keysAndValues ...any)
	Fatalw(msg string, keysAndValues ...any)
	Panicw(msg string, keysAndValues ...any)

	GetZapLogger() *zap.Logger
	GetZapSugarLogger() *zap.SugaredLogger
	Close()
}

type Mailer

type Mailer interface {
	SMTPSender() EmailSender
}

type Meilisearch

type Meilisearch interface {
	ApplyIndexConfigs(configData []byte) error
	WaitForTaskSuccess(taskUID int64) error
	AddDoc(indexName string, docPtr any) error
	DelDoc(indexName string, docId string) error
	UpdateDoc(indexName string, docPtr any) error
	GetDoc(indexName string, docId string, bindResult any) (bool, error)
	DeleteAllDocuments(indexName string) error
	Search(indexName string, query string, options *meilisearch.SearchRequest) *meilisearch.SearchResponse
}

type MongoDB

type MongoDB interface {
	Find(model mongodb.IDefaultModel, filter any) omgo.QueryI
	FindPage(model mongodb.IDefaultModel, filter any, res any, pageSize int64, currentPage int64, option ...*mongodb.FindPageOption) (totalDoc int64, totalPage int64)
	FindOne(model mongodb.IDefaultModel, filter any, res any) (bool, error)
	FindById(model mongodb.IDefaultModel, id string, res any) (bool, error)
	FindWithCursor(model mongodb.IDefaultModel, filter any) omgo.CursorI
	Insert(model mongodb.IDefaultModel) (*omgo.InsertOneResult, error)
	InsertMany(model mongodb.IDefaultModel, docs []any) (*omgo.InsertManyResult, error)
	Update(model mongodb.IDefaultModel) error
	Delete(model mongodb.IDefaultModel) error
	DeleteMany(model mongodb.IDefaultModel, filter any) (*omgo.DeleteResult, error)
	Aggregate(model mongodb.IDefaultModel, pipeline any, res any) error
}

type NewQueueCfg added in v0.2.5

type NewQueueCfg struct {
	// ConcurrentWorkers is the number of concurrent workers to process the queue
	ConcurrentWorkers int
	// FetchInterval is the interval in seconds to fetch new jobs
	FetchInterval int
	// DefaultRetries is number of retries for a job, can be overridden when creating a message
	DefaultRetries int
	// MaxConsumeDuration is the maximum time in seconds to consume a job, if exceeded, the job will be retried
	MaxConsumeDuration int
	// FetchLimit is the maximum number of jobs to fetch in a single fetch, 0 means no limit
	FetchLimit int
}

NewQueueCfg is the configuration for creating a new queue

type Queue

type Queue interface {
	NewQueue(name QueueName, handler func(string) bool, cfgs ...*NewQueueCfg) error
	PushRaw(queueName QueueName, payload string) error
	Push(queueName QueueName, payloadPtr any) error
	PushDelayed(queueName QueueName, payloadPtr any, delayDuration time.Duration) error
	PushDelayedRaw(queueName QueueName, payload string, delayDuration time.Duration) error
	PushScheduledRaw(queueName QueueName, payload string, t time.Time) error
	PushScheduled(queueName QueueName, payloadPtr any, t time.Time) error
}

type QueueName

type QueueName string

Jump to

Keyboard shortcuts

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