package projectuser import ( "joybuywork/internal/repository/cache" "joybuywork/internal/repository/dao" "joybuywork/internal/repository/model" ) type Option func(pu *ProjectUser) func WithDao(d *dao.Query) Option { return func(pu *ProjectUser) { pu.Context.Init(pu.Ctx, d, pu.BE()) } } func WithInit(projectId int64, userId string) Option { return func(pu *ProjectUser) { pu.withInit = &initData{ ProjectID: projectId, UserID: userId, } } } func WithUser(user *model.ProjectUser) Option { return func(pu *ProjectUser) { pu.user = user } } func WithUserId(userId int64) Option { return func(pu *ProjectUser) { pu.user, _ = cache.NewProjectUser(pu.Ctx).FindById(userId) } }