fix column name
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-01-15 10:55:57 +11:00
parent 95125b691d
commit db63b89c61
3 changed files with 5 additions and 5 deletions

View File

@@ -11,7 +11,7 @@ type Audit struct {
UserId int `db:"UserId" json:"userId"`
SecretId int `db:"SecretId" json:"secretId"`
EventText string `db:"EventText" json:"eventText"`
Timestamp time.Time `db:"Timestamp" json:"Timestamp"`
EventTime time.Time `db:"EventTime" json:"eventTime"`
}
// AuditAdd adds a new audit record to the database
@@ -19,11 +19,11 @@ func (a *Audit) AuditAdd() (*Audit, error) {
var err error
// Populate timestamp field if not already set
if a.Timestamp.IsZero() {
a.Timestamp = time.Now()
if a.EventTime.IsZero() {
a.EventTime = time.Now()
}
result, err := db.NamedExec(("INSERT INTO audit (UserId, SecretId, EventText, Timestamp) VALUES (:UserId, :SecretId, :EventText, :Timestamp);"), a)
result, err := db.NamedExec(("INSERT INTO audit (UserId, SecretId, EventText, EventTime) VALUES (:UserId, :SecretId, :EventText, :EventTime);"), a)
if err != nil {
log.Printf("AuditAdd error executing sql record : '%s'\n", err)

View File

@@ -84,7 +84,7 @@ const createAudit string = `
UserId INTEGER DEFAULT 0,
SecretId INTEGER DEFAULT 0,
EventText VARCHAR,
Timestamp datetime
EventTime datetime
);
`