mysql

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IMysqlDatabaseObject

type IMysqlDatabaseObject interface {
	GetUpdatedAt() time.Time
	SetUpdatedAt(time time.Time)
	GetCreatedAt() time.Time
	SetCreatedAt(time time.Time)
	GetIsActive() bool
	SetIsActive(isActive bool)
}

type IMysqlRepository

type IMysqlRepository[T IMysqlDatabaseObject] interface {
	Create(entity T, table string) (*T, error)
	Count(whereStatement interface{}, table string) (int64, error)
	Get(whereStatement interface{}, table string) (*T, error)
	GetList(whereStatement interface{}, table string) ([]T, error)
	Update(entity T, whereStatement interface{}, table string) (*T, error)
	Remove(whereStatement interface{}, table string) error
}

type MysqlDatabaseObject

type MysqlDatabaseObject struct {
	Section   primitive.ObjectID
	UpdatedAt time.Time
	CreatedAt time.Time
	IsActive  bool
}

func (*MysqlDatabaseObject) GetCreatedAt

func (do *MysqlDatabaseObject) GetCreatedAt() time.Time

func (*MysqlDatabaseObject) GetIsActive

func (do *MysqlDatabaseObject) GetIsActive() bool

func (*MysqlDatabaseObject) GetUpdatedAt

func (do *MysqlDatabaseObject) GetUpdatedAt() time.Time

func (*MysqlDatabaseObject) SetCreatedAt

func (do *MysqlDatabaseObject) SetCreatedAt(time time.Time)

func (*MysqlDatabaseObject) SetIsActive

func (do *MysqlDatabaseObject) SetIsActive(isActive bool)

func (*MysqlDatabaseObject) SetUpdatedAt

func (do *MysqlDatabaseObject) SetUpdatedAt(time time.Time)

type MysqlRepository

type MysqlRepository[T IMysqlDatabaseObject] struct {
	// contains filtered or unexported fields
}

func NewMysqlRepository

func NewMysqlRepository[T IMysqlDatabaseObject](db *gorm.DB) *MysqlRepository[T]

func (*MysqlRepository[T]) Count

func (r *MysqlRepository[T]) Count(whereStatement interface{}, table string) (int64, error)

func (*MysqlRepository[T]) Create

func (r *MysqlRepository[T]) Create(entity *T, table string) (*T, error)

func (*MysqlRepository[T]) Get

func (r *MysqlRepository[T]) Get(whereStatement interface{}, table string) (*T, error)

func (*MysqlRepository[T]) GetList

func (r *MysqlRepository[T]) GetList(whereStatement interface{}, table string) ([]T, error)

func (*MysqlRepository[T]) Remove

func (r *MysqlRepository[T]) Remove(whereStatement interface{}, table string) error

func (*MysqlRepository[T]) Update

func (r *MysqlRepository[T]) Update(entity T, whereStatement interface{}, table string) (*T, error)

Jump to

Keyboard shortcuts

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