database

package
v0.0.0-...-732b81e Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CourseNotFound = "course not found"
)
View Source
const (
	StudentNotFound = "student not found"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CourseDB

type CourseDB struct {
	ID               int64     `gorm:"primaryKey, column:id"`
	Description      string    `gorm:"column:description"`
	Outline          string    `gorm:"column:outline"`
	RegistrationDate time.Time `gorm:"column:registration_date"`
}

func (*CourseDB) CopyToCourseDomain

func (c *CourseDB) CopyToCourseDomain() domain.CourseDomain

func (*CourseDB) TableName

func (*CourseDB) TableName() string

type CoursePostgresDB

type CoursePostgresDB struct {
	DB          *gorm.DB
	LoggerSugar *zap.SugaredLogger
}

func NewCoursePostgresDB

func NewCoursePostgresDB(gormDB *gorm.DB, loggerSugar *zap.SugaredLogger) CoursePostgresDB

func (*CoursePostgresDB) GetByID

func (cp *CoursePostgresDB) GetByID(contextControl domain.ContextControl, ID int64) (domain.CourseDomain, bool, error)

func (*CoursePostgresDB) GetCourses

func (cp *CoursePostgresDB) GetCourses(contextControl domain.ContextControl, courses []domain.CourseDomain) ([]domain.CourseDomain, error)

func (*CoursePostgresDB) Save

func (cp *CoursePostgresDB) Save(contextControl domain.ContextControl, courseDomain domain.CourseDomain) (domain.CourseDomain, error)

type StudentDB

type StudentDB struct {
	ID               int64     `gorm:"primaryKey, column:id"`
	Name             string    `gorm:"column:name"`
	RegistrationDate time.Time `gorm:"column:registration_date"`
}

func (*StudentDB) CopyToStudentDomain

func (c *StudentDB) CopyToStudentDomain() domain.StudentDomain

func (*StudentDB) TableName

func (*StudentDB) TableName() string

type StudentPostgresDB

type StudentPostgresDB struct {
	DB          *gorm.DB
	LoggerSugar *zap.SugaredLogger
}

func NewStudentPostgresDB

func NewStudentPostgresDB(gormDB *gorm.DB, loggerSugar *zap.SugaredLogger) StudentPostgresDB

func (*StudentPostgresDB) GetByID

func (cp *StudentPostgresDB) GetByID(contextControl domain.ContextControl, ID int64) (domain.StudentDomain, bool, error)

func (*StudentPostgresDB) GetStudents

func (cp *StudentPostgresDB) GetStudents(contextControl domain.ContextControl, students []domain.StudentDomain) ([]domain.StudentDomain, error)

func (*StudentPostgresDB) Save

func (cp *StudentPostgresDB) Save(contextControl domain.ContextControl, studentDomain domain.StudentDomain) (domain.StudentDomain, error)

Jump to

Keyboard shortcuts

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