Documentation
¶
Index ¶
Constants ¶
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.
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 ¶
var BuiltInSecurityFields = []string{ FieldNameIsDeleted, FieldNameCreatedAt, FieldNameLastModifiedAt, FieldNameCreatedByUserId, FieldNameCreatedByUserNameId, FieldNameLastModifiedByUserId, FieldNameLastModifiedByUserNameId, }
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
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 ¶
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