models

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 2, 2026 License: MIT Imports: 1 Imported by: 8 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Model package

Index

Constants

View Source
const SystemActor = "system"

SystemActor is the canonical created_by/updated_by value for a write not driven by an authenticated user - event consumers, cron jobs, backfills. Services stamp this rather than leaving *_by empty or inventing a per-service string.

Variables

This section is empty.

Functions

func StampCreate added in v0.1.0

func StampCreate(a *Auditable, userID string, now time.Time)

StampCreate sets the create and update audit fields to the same user and time. Call it from a data layer's Create* with the acting user's canonical id (or SystemActor for a non-user write).

func StampUpdate added in v0.1.0

func StampUpdate(a *Auditable, userID string, now time.Time)

StampUpdate advances the update audit fields, leaving CreatedAt/CreatedBy untouched. Call it from every mutating data-layer path with the acting user's canonical id (or SystemActor).

Types

type Auditable

type Auditable struct {
	CreatedAt time.Time  `bson:"created_at" json:"created_at" jsonapi:"attr,created_at"`
	CreatedBy string     `bson:"created_by" json:"created_by" jsonapi:"attr,created_by"`
	UpdatedAt time.Time  `bson:"updated_at" json:"updated_at" jsonapi:"attr,updated_at"`
	UpdatedBy string     `bson:"updated_by" json:"updated_by" jsonapi:"attr,updated_by"`
	DeletedAt *time.Time `bson:"deleted_at,omitempty" json:"deleted_at" jsonapi:"attr,deleted_at,omitempty"`
	DeletedBy *string    `bson:"deleted_by,omitempty" json:"deleted_by" jsonapi:"attr,deleted_by,omitempty"`
}

Base auditable model

type Property

type Property struct {
	Name  string `json:"name" jsonapi:"attr,name"`
	Kind  string `json:"kind" jsonapi:"attr,kind"`
	Value string `json:"value" jsonapi:"attr,value"`
}

Property embedded model

type Tag

type Tag struct {
	Name  string `json:"name" jsonapi:"attr,name"`
	Value string `json:"value" jsonapi:"attr,value"`
}

Tag embedded model

Jump to

Keyboard shortcuts

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