persistence

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSystemConfigModelNil = errors.New("system config model can't be nil")

Functions

func CloseDB

func CloseDB(t *testing.T, gdb *gorm.DB)

Close the gorm database connection

func GetMockDB

func GetMockDB() (*gorm.DB, sqlmock.Sqlmock, error)

Create a mock database connection

func NewSystemConfigRepository

func NewSystemConfigRepository(db *gorm.DB) repository.SystemConfigRepository

NewSystemConfigRepository creates a new systemConfig repository.

Types

type MultiString

type MultiString []string

MultiString is a custom type for handling arrays of strings with GORM.

func (MultiString) GormDBDataType

func (s MultiString) GormDBDataType(db *gorm.DB, field *schema.Field) string

GormDBDataType gorm db data type

func (MultiString) GormDataType

func (s MultiString) GormDataType() string

GormDataType gorm common data type

func (*MultiString) Scan

func (s *MultiString) Scan(src any) error

Scan implements the Scanner interface for the MultiString type.

func (MultiString) Value

func (s MultiString) Value() (driver.Value, error)

Value implements the Valuer interface for the MultiString type.

type SystemConfigModel

type SystemConfigModel struct {
	gorm.Model
	Tenant      string
	Env         string
	Type        string
	Config      string
	Description string
	Creator     string
	Modifier    string
}

SystemConfigModel is a DO used to map the entity to the database.

func (*SystemConfigModel) FromEntity

func (m *SystemConfigModel) FromEntity(e *entity.SystemConfig) error

FromEntity converts an entity to a DO.

func (*SystemConfigModel) TableName

func (m *SystemConfigModel) TableName() string

The TableName method returns the name of the database table that the struct is mapped to.

func (*SystemConfigModel) ToEntity

func (m *SystemConfigModel) ToEntity() (*entity.SystemConfig, error)

ToEntity converts the DO to an entity.

Jump to

Keyboard shortcuts

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