non-persistent tag

non-persistent tag Overview

Sqac annotated go structs are used to supply the sqac runtime with the information required to create and alter tables in the database. The following examples illustrate the use of the “-” ‘sqac:’ tag described in the Sqac Tag Overview section of this document.

The “-” tag is used to declare a field in the source go struct as being non-persistent (not present) in the database table schema. Non-persistent fields are useful for values that are to be determined client-side, or for input fields that should not be saved.

“-” example

The following example illustrates the use of ‘sqac:’ tag “-” to declare a go struct field as non-persistent in the database.

  // Declare a struct to be used as the source for table creation.
  type Depot struct {
    ...
    Password string       `db:"password" sqac:"-"`    // column will not be created in the database
    ...
    ...
  }