datatypes

package module
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrContextNotFound = "invalid context or context missing"
)

Functions

func RegisterCallbacks

func RegisterCallbacks(db *gorm.DB)

RegisterCallbacks register callback into GORM DB

Types

type CreationAudited

type CreationAudited struct {
	CreatedBy *string
	CreatedAt time.Time
}

func (CreationAudited) GetCreatedBy

func (model CreationAudited) GetCreatedBy() *string

GetCreatedBy get created by

func (*CreationAudited) SetCreatedBy

func (model *CreationAudited) SetCreatedBy(createdBy interface{})

SetCreatedBy set created by

type DeletionAudited

type DeletionAudited struct {
	DeletedBy *string
	DeletedAt *time.Time
}

func (DeletionAudited) GetDeletedBy

func (model DeletionAudited) GetDeletedBy() *string

GetDeletedBy get deleted by

func (*DeletionAudited) SetDeletedBy

func (model *DeletionAudited) SetDeletedBy(updatedBy interface{})

SetDeletedBy set deleted by

type FullAudited

FullAudited make Model Auditable, embed `datatypes.FullAudited` into your model as anonymous field to make the model auditable

type User struct {
  gorm.Model
  datatypes.FullAudited
}

type ICreationAudited

type ICreationAudited interface {
	SetCreatedBy(createdBy interface{})
	GetCreatedBy() string
}

type IDeletionAuditable

type IDeletionAuditable interface {
	SetDeletedBy(deletedBy interface{})
	GetDeletedBy() string
}

type IModificationAuditable

type IModificationAuditable interface {
	SetUpdatedBy(updatedBy interface{})
	GetUpdatedBy() string
}

type ModificationAudited

type ModificationAudited struct {
	UpdatedBy *string
	UpdatedAt time.Time
}

func (ModificationAudited) GetUpdatedBy

func (model ModificationAudited) GetUpdatedBy() *string

GetUpdatedBy get updated by

func (*ModificationAudited) SetUpdatedBy

func (model *ModificationAudited) SetUpdatedBy(updatedBy interface{})

SetUpdatedBy set updated by

type NanoID

type NanoID struct {
	ID string `json:"id"`
}

func (*NanoID) BeforeCreate

func (u *NanoID) BeforeCreate(tx *gorm.DB) error

type TenantID

type TenantID sql.NullString

func NewTenantId

func NewTenantId(s string) TenantID

func (TenantID) GormValue

func (t TenantID) GormValue(ctx context.Context, db *gorm.DB) (expr clause.Expr)

func (TenantID) MarshalJSON

func (t TenantID) MarshalJSON() ([]byte, error)

func (TenantID) QueryClauses

func (TenantID) QueryClauses(f *schema.Field) []clause.Interface

func (*TenantID) Scan

func (t *TenantID) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*TenantID) UnmarshalJSON

func (t *TenantID) UnmarshalJSON(b []byte) error

func (TenantID) Value

func (t TenantID) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type TenantIDQueryClause

type TenantIDQueryClause struct {
	Field *schema.Field
}

func (TenantIDQueryClause) Build

func (TenantIDQueryClause) MergeClause

func (sd TenantIDQueryClause) MergeClause(*clause.Clause)

func (TenantIDQueryClause) ModifyStatement

func (sd TenantIDQueryClause) ModifyStatement(stmt *gorm.Statement)

func (TenantIDQueryClause) Name

func (sd TenantIDQueryClause) Name() string

type UUID

type UUID struct {
	ID string `gorm:"primarykey,type:char(36)" json:"id"`
}

func (*UUID) BeforeCreate

func (u *UUID) BeforeCreate(tx *gorm.DB) error

Jump to

Keyboard shortcuts

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