base

package
v1.137.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 2 Imported by: 2 modules, 3 packages

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

Index

Constants

View Source
const (
	FieldNameIsDeleted                = "is_deleted"
	FieldNameCreatedAt                = "created_at"
	FieldNameLastModifiedAt           = "last_modified_at"
	FieldNameCreatedByUserId          = "created_by_user_id"
	FieldNameCreatedByUserNameId      = "created_by_user_nameid"
	FieldNameLastModifiedByUserId     = "last_modified_by_user_id"
	FieldNameLastModifiedByUserNameId = "last_modified_by_user_nameid"
)

The built-in security fields are the columns the library writes itself on a table write: the soft-delete flag, the two timestamps and who created and last changed the row. No request may set them. The api package refuses an endpoint that declares one as a parameter when it is registered, and every table write that has a request drops whatever value the data carries for them, whatever its source, and writes its own. Only internal code (a write with no request: jobs, migrations, seeding) may set the identity fields.

The row id and uid are not on the list: the database assigns them, and edit, read and delete endpoints declare them as parameters to name a row.

View Source
const (
	// SystemUserId and SystemUserNameId: internal code, a write with no request
	// (jobs, migrations, seeding) that did not set an identity of its own. No
	// request ever writes them.
	SystemUserId     = "0"
	SystemUserNameId = "SYSTEM"

	// AnonymousUserId and AnonymousUserNameId: a request with no signed-in user,
	// on an endpoint open to anyone.
	AnonymousUserId     = "-1"
	AnonymousUserNameId = "ANONYMOUS"

	// ServiceUserNameIdPrefix starts the name recorded for a request with no
	// signed-in user whose caller presented a client certificate the TLS layer
	// verified: "SERVICE:" and the certificate's identity. Its id is
	// AnonymousUserId: a service has no user row.
	ServiceUserNameIdPrefix = "SERVICE:"
)

The identity a table write records, told apart by what the library knows of the caller. Identity columns hold text in the library's own DDL; the ids are written as these strings, which a signed numeric column also accepts.

Variables

BuiltInSecurityFields lists the built-in security fields. It is the one list both the registration check and the table writes read; treat it as read-only.

Functions

func IsBuiltInSecurityField added in v1.137.0

func IsBuiltInSecurityField(name string) bool

IsBuiltInSecurityField reports whether name is one of BuiltInSecurityFields, compared without case: MariaDB, SQL Server and Oracle fold the case of an unquoted column name, so "CREATED_AT" names the same column as "created_at".

func NormalizeDriverName

func NormalizeDriverName(driverName string) string

NormalizeDriverName maps the Go MySQL driver name "mysql" to "mariadb" so all switch cases can use a single canonical name. Keep Driver() returning "mysql" (actual Go driver) and StringToDXDatabaseType() accepting both "mysql" and "mariadb".

Types

type DXDatabaseType

type DXDatabaseType int64
const (
	UnknownDatabaseType DXDatabaseType = iota
	DXDatabaseTypePostgreSQL
	DXDatabaseTypeMariaDB
	DXDatabaseTypeOracle
	DXDatabaseTypeSQLServer
	DXDatabaseTypePostgresSQLV2
)

func StringToDXDatabaseType

func StringToDXDatabaseType(v string) DXDatabaseType

func (DXDatabaseType) Driver

func (t DXDatabaseType) Driver() string

func (DXDatabaseType) IsValid

func (t DXDatabaseType) IsValid() bool

func (DXDatabaseType) String

func (t DXDatabaseType) String() string

Jump to

Keyboard shortcuts

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