github.com/machinefi/w3bstream@v1.6.5-rc9.0.20240426031326-b8c7c4876e72/pkg/models/event_log.go (about)

     1  package models
     2  
     3  import "github.com/machinefi/w3bstream/pkg/depends/kit/sqlx/datatypes"
     4  
     5  // EventLog database model event
     6  // @def primary              ID
     7  // @def index I_event_id     EventID
     8  // @def index I_project_id   ProjectID
     9  // @def index I_publisher_id PublisherID
    10  // @def index I_created_at   CreatedAt
    11  //
    12  //go:generate toolkit gen model EventLog --database DB
    13  type EventLog struct {
    14  	datatypes.PrimaryID
    15  	EventInfo
    16  	datatypes.OperationTimes
    17  }
    18  
    19  type EventInfo struct {
    20  	EventID string `db:"f_event_id" json:"eventID"`
    21  	RelProject
    22  	RelPublisher
    23  	// PublishedAt the timestamp when device publish event
    24  	PublishedAt int64 `db:"f_published_at" json:"publishedAt"`
    25  	// ReceivedAt the timestamp when event received by us
    26  	ReceivedAt int64 `db:"f_received_at" json:"receivedAt"`
    27  	// RespondedAt the timestamp when event handled and send response
    28  	RespondedAt int64 `db:"f_responded_at" json:"respondedAt"`
    29  }