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 ( ErrorNone error = nil ErrorLogBodyIsEmpty error = errors.New(smodel.ErrBase + smodel.ErrSep + ErrLog + smodel.ErrSep + ErrBody + smodel.ErrSep + ErrEmpty) ErrorLogHeaderIsEmpty error = errors.New(smodel.ErrBase + smodel.ErrSep + ErrLog + smodel.ErrSep + ErrHeader + smodel.ErrSep + ErrEmpty) ErrorLogDataIsEmpty error = errors.New(smodel.ErrBase + smodel.ErrSep + ErrLog + smodel.ErrSep + ErrData + smodel.ErrSep + ErrEmpty) )
View Source
var ERRORS []error = []error{ ErrorNone, ErrorLogBodyIsEmpty, ErrorLogHeaderIsEmpty, ErrorLogDataIsEmpty, }
View Source
var MESSAGES []string = []string{}
View Source
var (
MessageNone string = ""
)
Functions ¶
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 (*LogBody) IsNotEmpty ¶
IsNotEmpty returns true if the LogBody is not empty.
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) IsNotEmpty ¶
IsNotEmpty returns true if the LogHeader is not empty.
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 )
Click to show internal directories.
Click to hide internal directories.