Skip to main content

auditable.go

auditable.go - Overview

  1. Overview Defines two struct types, TimeAuditable and UserAuditable, which are intended to be embedded in other structs to provide auditing information.

  2. Detailed Documentation

TimeAuditable

  • Purpose: Provides fields for tracking creation and update timestamps.

  • Parameters: None

  • Returns: None

    • CreatedAt:
      • Purpose: Stores the timestamp of when the record was created.
      • Type: time.Time
      • Description: Uses the bun:"created_at" tag for database mapping and json:"createdAt" for JSON serialization.
    • UpdatedAt:
      • Purpose: Stores the timestamp of when the record was last updated.
      • Type: time.Time
      • Description: Uses the bun:"updated_at" tag for database mapping and json:"updatedAt" for JSON serialization.

UserAuditable

  • Purpose: Provides fields for tracking the user who created and updated the record.

  • Parameters: None

  • Returns: None

    • CreatedBy:
      • Purpose: Stores the identifier of the user who created the record.
      • Type: string
      • Description: Uses the bun:"created_by" tag for database mapping and json:"createdBy" for JSON serialization.
    • UpdatedBy:
      • Purpose: Stores the identifier of the user who last updated the record.
      • Type: string
      • Description: Uses the bun:"updated_by" tag for database mapping and json:"updatedBy" for JSON serialization.

Include in Getting Started: NO