dao

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LevelBasic        = "basic"
	LevelIntermediate = "intermediate"
	LevelAdvanced     = "advanced"
	RTypeQuestion     = "question"
	RTypeCase         = "case"
)

Variables

This section is empty.

Functions

func InitTables

func InitTables(db *egorm.Component) error

Types

type Skill

type Skill struct {
	Id     int64
	Labels sqlx.JsonColumn[[]string] `gorm:"type:varchar(512)"`
	// Name 描述的是什么技能
	Name string `gorm:"unique"`
	// 技能本身的描述
	Desc  string
	Ctime int64
	Utime int64 `gorm:"index"`
}

func (Skill) TableName

func (Skill) TableName() string

type SkillDAO

type SkillDAO interface {
	// Create 管理端接口
	Create(ctx context.Context, skill Skill, skillLevels []SkillLevel) (int64, error)
	// Update 管理端接口
	Update(ctx context.Context, skill Skill, skillLevels []SkillLevel) error
	SaveRefs(ctx context.Context, reqs []SkillRef) error
	// List 列表
	List(ctx context.Context, offset, limit int) ([]Skill, error)
	// Info 详情
	Info(ctx context.Context, id int64) (Skill, error)
	SkillLevelInfo(tx context.Context, id int64) ([]SkillLevel, error)
	SkillLevelInfoByIDs(tx context.Context, ids []int64) ([]SkillLevel, error)
	// Refs id 为skill的id
	Refs(ctx context.Context, id int64) ([]SkillRef, error)
	// RefsByLevelIDs ids 为 SkillLevel 的 ID
	RefsByLevelIDs(ctx context.Context, ids []int64) ([]SkillRef, error)
	Count(ctx context.Context) (int64, error)
}

func NewSkillDAO

func NewSkillDAO(db *egorm.Component) SkillDAO

type SkillLevel

type SkillLevel struct {
	Id  int64
	Sid int64 `gorm:"uniqueIndex:sid_level"`
	// basic, intermediate, advanced
	// sid 和 level 构成唯一索引
	Level string `gorm:"uniqueIndex:sid_level;type:varchar(64)"`
	// 在相应等级下,简历的写法
	Desc  string
	Ctime int64
	Utime int64 `gorm:"index"`
}

func (SkillLevel) TableName

func (SkillLevel) TableName() string

type SkillRef

type SkillRef struct {
	Id int64
	// Skill 的 ID
	// 这个是冗余字段,方便查找
	Sid int64 `gorm:"index"`
	// Skill Level 的 ID
	Slid int64 `gorm:"index"`
	// 相关 id,
	Rid int64
	// 关联的类型,question-八股文,case-案例
	Rtype string
	Ctime int64
	Utime int64 `gorm:"index"`
}

SkillRef 是一个面试者需要准备好面试题,面试案例之后,才可以写到简历上的 - save: 会把所有的 rid 和 rtype 传过来,删除原本的,而后插入新的 也就是说,Skill 里面的 Save 只是保存基本的信息,这里是新的保存关联关系的接口

func (SkillRef) TableName

func (SkillRef) TableName() string

Jump to

Keyboard shortcuts

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