domain

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrLog    string = "log"
	ErrBody   string = "body"
	ErrHeader string = "header"
	ErrData   string = "data"
)
View Source
const (
	ErrEmpty string = "empty"
)

Variables

View Source
var MESSAGES []string = []string{}
View Source
var (
	MessageNone string = ""
)

Functions

func GetErrors

func GetErrors() []error

func GetMessages

func GetMessages() []string

Types

type LogBody

type LogBody struct {
	Message string `json:"message"` // Message is the message of the log.
}

LogBody is a struct that represents the body of a log.

func NewEmptyLogBody

func NewEmptyLogBody() *LogBody

NewEmptyLogBody creates a new *LogBody with empty values.

func NewLogBody

func NewLogBody(message string) *LogBody

NewLogBody creates a new *LogBody.

func (*LogBody) Clear

func (s *LogBody) Clear()

Clear clears the LogBody.

func (*LogBody) Clone

func (s *LogBody) Clone() *LogBody

Clone returns a clone of the LogBody.

func (*LogBody) Equals

func (s *LogBody) Equals(other *LogBody) bool

Equals returns true if the LogBody is equal to the other LogBody.

func (*LogBody) IsEmpty

func (s *LogBody) IsEmpty() bool

IsEmpty returns true if the LogBody is empty.

func (*LogBody) IsNotEmpty

func (s *LogBody) IsNotEmpty() bool

IsNotEmpty returns true if the LogBody is not empty.

func (*LogBody) String

func (s *LogBody) String() string

String returns a string representation of the LogBody.

func (*LogBody) Validate

func (s *LogBody) Validate() error

Validate validates the LogBody.

type LogHeader

type LogHeader struct {
	EventDate   time.Time `json:"event_date"`                              // EventDate is the date of the event.
	LogType     LogType   `json:"log_type"`                                // LogType is the type of the log.
	ServiceName string    `json:"service_name" gorm:"not null;default:''"` // ServiceName is the name of source micro service.
	Path        string    `json:"path" gorm:"not null;default:''"`         // Path is the name of the source function of the source micro service.
	UserId      string    `json:"user_id" gorm:"not null;default:''"`      // UserId represents the id of the user that the log is for.
}

LogHeader is a struct that represents the header of a log.

func NewEmptyLogHeader

func NewEmptyLogHeader() *LogHeader

NewEmptyLogHeader creates a new *LogHeader with empty values.

func NewLogHeader

func NewLogHeader(eventDate time.Time, logType LogType, serviceName string, path string, userId string) *LogHeader

NewLogHeader creates a new *LogHeader.

func (*LogHeader) Clear

func (s *LogHeader) Clear()

Clear clears the LogHeader.

func (*LogHeader) Clone

func (s *LogHeader) Clone() *LogHeader

Clone returns a clone of the LogHeader.

func (*LogHeader) Equals

func (s *LogHeader) Equals(other *LogHeader) bool

Equals returns true if the LogHeader is equal to the other LogHeader.

func (*LogHeader) IsEmpty

func (s *LogHeader) IsEmpty() bool

IsEmpty returns true if the LogHeader is empty.

func (*LogHeader) IsNotEmpty

func (s *LogHeader) IsNotEmpty() bool

IsNotEmpty returns true if the LogHeader is not empty.

func (*LogHeader) String

func (s *LogHeader) String() string

String returns a string representation of the LogHeader.

func (*LogHeader) Validate

func (s *LogHeader) Validate() error

Validate validates the LogHeader.

type LogSortField

type LogSortField int8

LogSortField is a type that represents the sort fields of a log data.

const (
	LogSortFieldNONE LogSortField = iota
	LogSortFieldId
	LogSortFieldServiceName
	LogSortFieldEventDate
	LogSortFieldCreatedAt
	LogSortFieldUpdatedAt
)

type LogType

type LogType int8

LogType is a type that represents the type of a log.

const (
	LogTypeNONE LogType = iota
	LogTypeINFO
	LogTypeWARNING
	LogTypeERROR
	LogTypeDEBUG
)

Jump to

Keyboard shortcuts

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