Help us shape the future of Go! Take the 2026 Go Developer Survey

entity

package
v0.3.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxPageSize int = 200
	DefPageSize int = 20
)

Variables

This section is empty.

Functions

func MustInitSnowflake

func MustInitSnowflake(node int64)

Types

type Envelope

type Envelope struct {
	ID        uint
	CreatedAt time.Time
	Headers   map[string]string
	Version   string
	Topic     string
	Group     string
	Status    enum.Status
	Message   any
	Payload   []byte
	Retries   int
	Tag       any
	Logger    *slog.Logger
}

func NewEnvelope

func NewEnvelope(version string, topic string, msg any) *Envelope

func (*Envelope) AddHeader

func (e *Envelope) AddHeader(key string, value string)

func (*Envelope) HeadersBytes

func (e *Envelope) HeadersBytes() ([]byte, error)

func (*Envelope) IDString

func (e *Envelope) IDString() string

func (*Envelope) Log

func (e *Envelope) Log() *slog.Logger

func (*Envelope) PayloadBytes

func (e *Envelope) PayloadBytes() ([]byte, error)

func (*Envelope) Verify

func (e *Envelope) Verify() error

func (*Envelope) WithGroup

func (e *Envelope) WithGroup(group string) *Envelope

func (*Envelope) WithPayload

func (e *Envelope) WithPayload(payload []byte) *Envelope

func (*Envelope) WithTag

func (e *Envelope) WithTag(tag any) *Envelope

type Pagination

type Pagination struct {
	//@new
	Page int
	//@new
	PerPage   int
	Total     int
	TotalPage int
}

func NewPagination

func NewPagination(page int, perPage int) *Pagination

NewPagination constructs a new instance of type Pagination

func (Pagination) MarshalJSON

func (p Pagination) MarshalJSON() ([]byte, error)

MarshalJSON serializes type Pagination to json bytes

func (*Pagination) Normalize

func (p *Pagination) Normalize() Pagination

func (*Pagination) SetTotal

func (p *Pagination) SetTotal(total int)

func (Pagination) ShootNew

func (p Pagination) ShootNew()

ShootNew exists solely to fulfill the NewShooter interface contract

func (*Pagination) UnmarshalJSON

func (p *Pagination) UnmarshalJSON(data []byte) error

UnmarshalJSON deserializes json bytes to type Pagination

Jump to

Keyboard shortcuts

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