infrastructure

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: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LogSortMap map[mo.LogSortField]string = map[mo.LogSortField]string{
	mo.LogSortFieldId:          "id",
	mo.LogSortFieldServiceName: "service_name",
	mo.LogSortFieldEventDate:   "verified_at",
	mo.LogSortFieldCreatedAt:   "created_at",
	mo.LogSortFieldUpdatedAt:   "updated_at",
}

Functions

This section is empty.

Types

type LogData

type LogData struct {
	tgorm.Model

	EventDate   time.Time `json:"event_date" gorm:"not null;default:CURRENT_TIMESTAMP"` // EventDate is the date of the event.
	LogType     int       `json:"log_type" gorm:"not null;default:0"`                   // 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.
	Message     string    `json:"message" gorm:"not null;default:''"`                   // Message is the message of the log.
}

LogData is a struct that represents the db mapper of a log.

func NewLogData

func NewLogData(id uuid.UUID,
	eventDate time.Time,
	logType int,
	serviceName string,
	path string,
	userId string,
	message string) *LogData

NewLogData creates a new *LogData.

func NewLogDataFromEntity

func NewLogDataFromEntity(entity *me.LogData) *LogData

NewLogDataFromEntity creates a new *LogData from entity.

func (*LogData) String

func (s *LogData) String() string

String returns a string representation of the LogData.

func (*LogData) ToEntity

func (s *LogData) ToEntity() *me.LogData

ToEntity returns a entity representation of the LogData.

type LogDatas

type LogDatas []*LogData

func NewLogDataFromEntities

func NewLogDataFromEntities(entities []me.LogData) LogDatas

NewLogDatasFromEntities creates a new []*LogData from entities.

func (LogDatas) ToEntities

func (s LogDatas) ToEntities() []me.LogData

ToEntities creates a new []me.LogData entity.

Jump to

Keyboard shortcuts

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