util

package
v1.54.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultItemCountPerPage = 10

Variables

This section is empty.

Functions

func BoolPtr added in v1.51.0

func BoolPtr(b bool) *bool

func Close

func Close(c io.Closer)

Close resource and prints error.

func ConnectRabbitMQ

func ConnectRabbitMQ(config string) (*amqp.Connection, error)

func Contains

func Contains(s []string, e string) bool

func GetTextPreview added in v1.41.0

func GetTextPreview(text string, options TextPreviewOptions) string

func MaxInt64 added in v1.19.0

func MaxInt64(a, b int64) int64

func MinMax

func MinMax(array []int32) (int32, int32)

func SQLNullInt64ToPtr

func SQLNullInt64ToPtr(v sql.NullInt64) *int64

Types

type Pages

type Pages struct {
	PageCount        int32
	ItemCountPerPage int32
	First            int32
	Current          int32
	Last             int32
	Previous         int32
	Next             int32
	FirstPageInRange int32
	LastPageInRange  int32
	TotalItemCount   int32
	PagesInRange     []int32
}

type Paginator

type Paginator struct {
	SQLSelect *goqu.SelectDataset

	ItemCountPerPage  int32
	CurrentPageNumber int32
	// contains filtered or unexported fields
}

func (*Paginator) Count

func (s *Paginator) Count(ctx context.Context) (int32, error)

func (*Paginator) GetCurrentItems

func (s *Paginator) GetCurrentItems(ctx context.Context) (*goqu.SelectDataset, error)

func (*Paginator) GetItemsByPage

func (s *Paginator) GetItemsByPage(ctx context.Context, pageNumber int32) (*goqu.SelectDataset, error)

func (*Paginator) GetPages

func (s *Paginator) GetPages(ctx context.Context) (*Pages, error)

func (*Paginator) GetTotalItemCount

func (s *Paginator) GetTotalItemCount(ctx context.Context) (int32, error)

type TextPreviewOptions added in v1.41.0

type TextPreviewOptions struct {
	Maxlength int
	Maxlines  int
}

Jump to

Keyboard shortcuts

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