repo

package
v0.0.0-...-9a81921 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2019 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const Guest = "guest"

Variables

View Source
var ErrAccessDenied = errors.New("access denied")
View Source
var ErrConnClosed = errors.New("connection is closed")
View Source
var ErrFieldAccessDenied = errors.New("field access denied")
View Source
var ErrNilPermitter = errors.New("permitter is nil")
View Source
var LessonLinkRegexp = regexp.MustCompile(`<!---LESSON_LINK--->\[(#\d+)\]\(.*?\)`)
View Source
var StudyLinkRegexp = regexp.MustCompile(`<!---STUDY_LINK--->\[(\w+\/[\w-]{1,39}#\d+)\]\(.*?\)`)
View Source
var UserAssetLinkRegexp = regexp.MustCompile(`<figure(?: class="(.*)")?><!---USER_ASSET_LINK---><a href=".*" rel="nofollow"><img src="(.*)" alt="(.*)"\/><\/a>(?:<figcaption>(.*)<\/figcaption>)?<\/figure>`)
View Source
var UserLinkRegexp = regexp.MustCompile(`<!---USER_LINK--->\[(@\w+)\]\(.*?\)`)

Functions

This section is empty.

Types

type ActivityAssetPermit

type ActivityAssetPermit struct {
	// contains filtered or unexported fields
}

func (*ActivityAssetPermit) ActivityID

func (r *ActivityAssetPermit) ActivityID() (*mytype.OID, error)

func (*ActivityAssetPermit) AssetID

func (r *ActivityAssetPermit) AssetID() (*mytype.OID, error)

func (*ActivityAssetPermit) CreatedAt

func (r *ActivityAssetPermit) CreatedAt() (time.Time, error)

func (*ActivityAssetPermit) Get

func (*ActivityAssetPermit) Number

func (r *ActivityAssetPermit) Number() (int32, error)

type ActivityAssetRepo

type ActivityAssetRepo struct {
	// contains filtered or unexported fields
}

func NewActivityAssetRepo

func NewActivityAssetRepo(conf *myconf.Config) *ActivityAssetRepo

func (*ActivityAssetRepo) CheckConnection

func (r *ActivityAssetRepo) CheckConnection() error

func (*ActivityAssetRepo) Close

func (r *ActivityAssetRepo) Close()

func (*ActivityAssetRepo) Connect

func (r *ActivityAssetRepo) Connect(
	ctx context.Context,
	activityAsset *data.ActivityAsset,
) (*ActivityAssetPermit, error)

func (*ActivityAssetRepo) CountByActivity

func (r *ActivityAssetRepo) CountByActivity(
	ctx context.Context,
	activityID string,
) (int32, error)

func (*ActivityAssetRepo) Disconnect

func (r *ActivityAssetRepo) Disconnect(
	ctx context.Context,
	activityAsset *data.ActivityAsset,
) error

func (*ActivityAssetRepo) Get

func (r *ActivityAssetRepo) Get(
	ctx context.Context,
	assetID string,
) (*ActivityAssetPermit, error)

func (*ActivityAssetRepo) GetByActivity

func (r *ActivityAssetRepo) GetByActivity(
	ctx context.Context,
	activityID string,
	po *data.PageOptions,
) ([]*ActivityAssetPermit, error)

func (*ActivityAssetRepo) GetByActivityAndNumber

func (r *ActivityAssetRepo) GetByActivityAndNumber(
	ctx context.Context,
	activityID string,
	number int32,
) (*ActivityAssetPermit, error)

func (*ActivityAssetRepo) Move

func (r *ActivityAssetRepo) Move(
	ctx context.Context,
	activityAsset *data.ActivityAsset,
	afterAssetID string,
) (*data.ActivityAsset, error)

func (*ActivityAssetRepo) Open

func (r *ActivityAssetRepo) Open(p *Permitter) error

type ActivityPermit

type ActivityPermit struct {
	// contains filtered or unexported fields
}

func (*ActivityPermit) AdvancedAt

func (r *ActivityPermit) AdvancedAt() (*time.Time, error)

func (*ActivityPermit) CreatedAt

func (r *ActivityPermit) CreatedAt() (time.Time, error)

func (*ActivityPermit) Description

func (r *ActivityPermit) Description() (string, error)

func (*ActivityPermit) Get

func (r *ActivityPermit) Get() *data.Activity

func (*ActivityPermit) ID

func (r *ActivityPermit) ID() (*mytype.OID, error)

func (*ActivityPermit) LessonID

func (r *ActivityPermit) LessonID() (*mytype.OID, error)

func (*ActivityPermit) Name

func (r *ActivityPermit) Name() (string, error)

func (*ActivityPermit) Number

func (r *ActivityPermit) Number() (int32, error)

func (*ActivityPermit) StudyID

func (r *ActivityPermit) StudyID() (*mytype.OID, error)

func (*ActivityPermit) UpdatedAt

func (r *ActivityPermit) UpdatedAt() (time.Time, error)

func (*ActivityPermit) UserID

func (r *ActivityPermit) UserID() (*mytype.OID, error)

type ActivityRepo

type ActivityRepo struct {
	// contains filtered or unexported fields
}

func NewActivityRepo

func NewActivityRepo(conf *myconf.Config) *ActivityRepo

func (*ActivityRepo) CheckConnection

func (r *ActivityRepo) CheckConnection() error

func (*ActivityRepo) Close

func (r *ActivityRepo) Close()

func (*ActivityRepo) CountByLesson

func (r *ActivityRepo) CountByLesson(
	ctx context.Context,
	lessonID string,
	filters *data.ActivityFilterOptions,
) (int32, error)

func (*ActivityRepo) CountBySearch

func (r *ActivityRepo) CountBySearch(
	ctx context.Context,
	filters *data.ActivityFilterOptions,
) (int32, error)

func (*ActivityRepo) CountByStudy

func (r *ActivityRepo) CountByStudy(
	ctx context.Context,
	studyID string,
	filters *data.ActivityFilterOptions,
) (int32, error)

func (*ActivityRepo) CountByUser

func (r *ActivityRepo) CountByUser(
	ctx context.Context,
	userID string,
	filters *data.ActivityFilterOptions,
) (int32, error)

func (*ActivityRepo) Create

func (r *ActivityRepo) Create(
	ctx context.Context,
	c *data.Activity,
) (*ActivityPermit, error)

func (*ActivityRepo) Delete

func (r *ActivityRepo) Delete(
	ctx context.Context,
	activity *data.Activity,
) error

func (*ActivityRepo) Get

func (r *ActivityRepo) Get(
	ctx context.Context,
	id string,
) (*ActivityPermit, error)

func (*ActivityRepo) GetByLesson

func (r *ActivityRepo) GetByLesson(
	ctx context.Context,
	lessonID string,
	po *data.PageOptions,
	filters *data.ActivityFilterOptions,
) ([]*ActivityPermit, error)

func (*ActivityRepo) GetByName

func (r *ActivityRepo) GetByName(
	ctx context.Context,
	studyID,
	name string,
) (*ActivityPermit, error)

func (*ActivityRepo) GetByNumber

func (r *ActivityRepo) GetByNumber(
	ctx context.Context,
	studyID string,
	number int32,
) (*ActivityPermit, error)

func (*ActivityRepo) GetByStudy

func (r *ActivityRepo) GetByStudy(
	ctx context.Context,
	studyID string,
	po *data.PageOptions,
	filters *data.ActivityFilterOptions,
) ([]*ActivityPermit, error)

func (*ActivityRepo) GetByStudyAndName

func (r *ActivityRepo) GetByStudyAndName(
	ctx context.Context,
	study,
	name string,
) (*ActivityPermit, error)

func (*ActivityRepo) GetByUser

func (r *ActivityRepo) GetByUser(
	ctx context.Context,
	userID string,
	po *data.PageOptions,
	filters *data.ActivityFilterOptions,
) ([]*ActivityPermit, error)

func (*ActivityRepo) Open

func (r *ActivityRepo) Open(p *Permitter) error

func (*ActivityRepo) Pull

func (r *ActivityRepo) Pull(
	ctx context.Context,
	id string,
) (*ActivityPermit, error)

func (*ActivityRepo) Search

func (*ActivityRepo) Update

func (r *ActivityRepo) Update(
	ctx context.Context,
	c *data.Activity,
) (*ActivityPermit, error)

func (*ActivityRepo) ViewerCanAdmin

func (r *ActivityRepo) ViewerCanAdmin(
	ctx context.Context,
	c *data.Activity,
) (bool, error)

type AppleablePermit

type AppleablePermit interface {
	AppledAt() time.Time
	ID() (*mytype.OID, error)
}

type AppledPermit

type AppledPermit struct {
	// contains filtered or unexported fields
}

func (*AppledPermit) AppleableID

func (r *AppledPermit) AppleableID() (*mytype.OID, error)

func (*AppledPermit) CreatedAt

func (r *AppledPermit) CreatedAt() (time.Time, error)

func (*AppledPermit) Get

func (r *AppledPermit) Get() *data.Appled

func (*AppledPermit) ID

func (r *AppledPermit) ID() (int32, error)

func (*AppledPermit) UserID

func (r *AppledPermit) UserID() (*mytype.OID, error)

type AppledRepo

type AppledRepo struct {
	// contains filtered or unexported fields
}

func NewAppledRepo

func NewAppledRepo(conf *myconf.Config) *AppledRepo

func (*AppledRepo) CheckConnection

func (r *AppledRepo) CheckConnection() error

func (*AppledRepo) Close

func (r *AppledRepo) Close()

func (*AppledRepo) Connect

func (r *AppledRepo) Connect(
	ctx context.Context,
	appled *data.Appled,
) (*AppledPermit, error)

func (*AppledRepo) CountByAppleable

func (r *AppledRepo) CountByAppleable(
	ctx context.Context,
	appleableID string,
) (int32, error)

func (*AppledRepo) CountByUser

func (r *AppledRepo) CountByUser(
	ctx context.Context,
	userID string,
) (int32, error)

func (*AppledRepo) Disconnect

func (r *AppledRepo) Disconnect(
	ctx context.Context,
	a *data.Appled,
) error

func (*AppledRepo) Get

func (r *AppledRepo) Get(
	ctx context.Context,
	a *data.Appled,
) (*AppledPermit, error)

func (*AppledRepo) GetByAppleable

func (r *AppledRepo) GetByAppleable(
	ctx context.Context,
	appleableID string,
	po *data.PageOptions,
) ([]*AppledPermit, error)

func (*AppledRepo) GetByUser

func (r *AppledRepo) GetByUser(
	ctx context.Context,
	userID string,
	po *data.PageOptions,
) ([]*AppledPermit, error)

func (*AppledRepo) Open

func (r *AppledRepo) Open(p *Permitter) error

func (*AppledRepo) ViewerCanApple

func (r *AppledRepo) ViewerCanApple(
	ctx context.Context,
	e *data.Appled,
) (bool, error)

type AssetPermit

type AssetPermit struct {
	// contains filtered or unexported fields
}

func (*AssetPermit) ContentType

func (r *AssetPermit) ContentType() (string, error)

func (*AssetPermit) CreatedAt

func (r *AssetPermit) CreatedAt() (time.Time, error)

func (*AssetPermit) Get

func (r *AssetPermit) Get() *data.Asset

func (*AssetPermit) ID

func (r *AssetPermit) ID() (int64, error)

func (*AssetPermit) Key

func (r *AssetPermit) Key() (string, error)

func (*AssetPermit) Name

func (r *AssetPermit) Name() (string, error)

func (*AssetPermit) Size

func (r *AssetPermit) Size() (int64, error)

func (*AssetPermit) Subtype

func (r *AssetPermit) Subtype() (string, error)

func (*AssetPermit) Type

func (r *AssetPermit) Type() (string, error)

func (*AssetPermit) UserID

func (r *AssetPermit) UserID() (*mytype.OID, error)

type AssetRepo

type AssetRepo struct {
	// contains filtered or unexported fields
}

func NewAssetRepo

func NewAssetRepo(conf *myconf.Config) *AssetRepo

func (*AssetRepo) CheckConnection

func (r *AssetRepo) CheckConnection() error

func (*AssetRepo) Close

func (r *AssetRepo) Close()

func (*AssetRepo) Create

func (r *AssetRepo) Create(
	ctx context.Context,
	a *data.Asset,
) (*AssetPermit, error)

func (*AssetRepo) Delete

func (r *AssetRepo) Delete(
	ctx context.Context,
	asset *data.Asset,
) error

func (*AssetRepo) Get

func (r *AssetRepo) Get(
	ctx context.Context,
	id int64,
) (*AssetPermit, error)

func (*AssetRepo) GetByKey

func (r *AssetRepo) GetByKey(
	ctx context.Context,
	key string,
) (*AssetPermit, error)

func (*AssetRepo) Open

func (r *AssetRepo) Open(p *Permitter) error

func (*AssetRepo) ViewerCanDelete

func (r *AssetRepo) ViewerCanDelete(
	ctx context.Context,
	l *data.Asset,
) bool

type CommentDraftBackupPermit

type CommentDraftBackupPermit struct {
	// contains filtered or unexported fields
}

func (*CommentDraftBackupPermit) CommentID

func (r *CommentDraftBackupPermit) CommentID() (*mytype.OID, error)

func (*CommentDraftBackupPermit) CreatedAt

func (r *CommentDraftBackupPermit) CreatedAt() (time.Time, error)

func (*CommentDraftBackupPermit) Draft

func (r *CommentDraftBackupPermit) Draft() (string, error)

func (*CommentDraftBackupPermit) Get

func (*CommentDraftBackupPermit) ID

func (*CommentDraftBackupPermit) UpdatedAt

func (r *CommentDraftBackupPermit) UpdatedAt() (time.Time, error)

type CommentDraftBackupRepo

type CommentDraftBackupRepo struct {
	// contains filtered or unexported fields
}

func NewCommentDraftBackupRepo

func NewCommentDraftBackupRepo(conf *myconf.Config) *CommentDraftBackupRepo

func (*CommentDraftBackupRepo) CheckConnection

func (r *CommentDraftBackupRepo) CheckConnection() error

func (*CommentDraftBackupRepo) Clear

func (r *CommentDraftBackupRepo) Clear(id string)

func (*CommentDraftBackupRepo) Close

func (r *CommentDraftBackupRepo) Close()

func (*CommentDraftBackupRepo) Get

func (*CommentDraftBackupRepo) GetByComment

func (r *CommentDraftBackupRepo) GetByComment(
	ctx context.Context,
	commentID string,
) ([]*CommentDraftBackupPermit, error)

func (*CommentDraftBackupRepo) Open

func (*CommentDraftBackupRepo) Pull

Same as Get(), but doesn't use the dataloader

func (*CommentDraftBackupRepo) Restore

func (r *CommentDraftBackupRepo) Restore(
	ctx context.Context,
	comment *data.Comment,
	backupID int32,
) error

type CommentPermit

type CommentPermit struct {
	// contains filtered or unexported fields
}

func (*CommentPermit) Body

func (r *CommentPermit) Body() (*mytype.Markdown, error)

func (*CommentPermit) CommentableID

func (r *CommentPermit) CommentableID() (*mytype.OID, error)

func (*CommentPermit) CreatedAt

func (r *CommentPermit) CreatedAt() (time.Time, error)

func (*CommentPermit) Draft

func (r *CommentPermit) Draft() (string, error)

func (*CommentPermit) Get

func (r *CommentPermit) Get() *data.Comment

func (*CommentPermit) ID

func (r *CommentPermit) ID() (*mytype.OID, error)

func (*CommentPermit) IsPublished

func (r *CommentPermit) IsPublished() (bool, error)

func (*CommentPermit) LastEditedAt

func (r *CommentPermit) LastEditedAt() (time.Time, error)

func (*CommentPermit) PublishedAt

func (r *CommentPermit) PublishedAt() (time.Time, error)

func (*CommentPermit) StudyID

func (r *CommentPermit) StudyID() (*mytype.OID, error)

func (*CommentPermit) Type

func (r *CommentPermit) Type() (string, error)

func (*CommentPermit) UpdatedAt

func (r *CommentPermit) UpdatedAt() (time.Time, error)

func (*CommentPermit) UserID

func (r *CommentPermit) UserID() (*mytype.OID, error)

type CommentRepo

type CommentRepo struct {
	// contains filtered or unexported fields
}

func NewCommentRepo

func NewCommentRepo(conf *myconf.Config) *CommentRepo

func (*CommentRepo) BatchGet

func (r *CommentRepo) BatchGet(
	ctx context.Context,
	ids []string,
) ([]*CommentPermit, error)

func (*CommentRepo) CheckConnection

func (r *CommentRepo) CheckConnection() error

func (*CommentRepo) Close

func (r *CommentRepo) Close()

func (*CommentRepo) CountByCommentable

func (r *CommentRepo) CountByCommentable(
	ctx context.Context,
	commentableID string,
	filters *data.CommentFilterOptions,
) (int32, error)

func (*CommentRepo) CountByLabel

func (r *CommentRepo) CountByLabel(
	ctx context.Context,
	labelID string,
	filters *data.CommentFilterOptions,
) (int32, error)

func (*CommentRepo) CountByStudy

func (r *CommentRepo) CountByStudy(
	ctx context.Context,
	studyID string,
	filters *data.CommentFilterOptions,
) (int32, error)

func (*CommentRepo) CountByUser

func (r *CommentRepo) CountByUser(
	ctx context.Context,
	userID string,
	filters *data.CommentFilterOptions,
) (int32, error)

func (*CommentRepo) Create

func (r *CommentRepo) Create(
	ctx context.Context,
	lc *data.Comment,
) (*CommentPermit, error)

func (*CommentRepo) Delete

func (r *CommentRepo) Delete(
	ctx context.Context,
	lc *data.Comment,
) error

func (*CommentRepo) Get

func (r *CommentRepo) Get(
	ctx context.Context,
	id string,
) (*CommentPermit, error)

func (*CommentRepo) GetByCommentable

func (r *CommentRepo) GetByCommentable(
	ctx context.Context,
	commentableID string,
	po *data.PageOptions,
	filters *data.CommentFilterOptions,
) ([]*CommentPermit, error)

func (*CommentRepo) GetByLabel

func (r *CommentRepo) GetByLabel(
	ctx context.Context,
	labelID string,
	po *data.PageOptions,
	filters *data.CommentFilterOptions,
) ([]*CommentPermit, error)

func (*CommentRepo) GetByStudy

func (r *CommentRepo) GetByStudy(
	ctx context.Context,
	studyID string,
	po *data.PageOptions,
	filters *data.CommentFilterOptions,
) ([]*CommentPermit, error)

func (*CommentRepo) GetByUser

func (r *CommentRepo) GetByUser(
	ctx context.Context,
	userID string,
	po *data.PageOptions,
	filters *data.CommentFilterOptions,
) ([]*CommentPermit, error)

func (*CommentRepo) GetUserNewComment

func (r *CommentRepo) GetUserNewComment(
	ctx context.Context,
	userID,
	commentableID string,
) (*CommentPermit, error)

func (*CommentRepo) Open

func (r *CommentRepo) Open(p *Permitter) error

func (*CommentRepo) Update

func (r *CommentRepo) Update(
	ctx context.Context,
	lc *data.Comment,
) (*CommentPermit, error)

func (*CommentRepo) ViewerCanDelete

func (r *CommentRepo) ViewerCanDelete(
	ctx context.Context,
	l *data.Comment,
) bool

func (*CommentRepo) ViewerCanUpdate

func (r *CommentRepo) ViewerCanUpdate(
	ctx context.Context,
	l *data.Comment,
) bool

type CourseLessonPermit

type CourseLessonPermit struct {
	// contains filtered or unexported fields
}

func (*CourseLessonPermit) CourseID

func (r *CourseLessonPermit) CourseID() (*mytype.OID, error)

func (*CourseLessonPermit) CreatedAt

func (r *CourseLessonPermit) CreatedAt() (time.Time, error)

func (*CourseLessonPermit) Get

func (*CourseLessonPermit) LessonID

func (r *CourseLessonPermit) LessonID() (*mytype.OID, error)

func (*CourseLessonPermit) Number

func (r *CourseLessonPermit) Number() (int32, error)

type CourseLessonRepo

type CourseLessonRepo struct {
	// contains filtered or unexported fields
}

func NewCourseLessonRepo

func NewCourseLessonRepo(conf *myconf.Config) *CourseLessonRepo

func (*CourseLessonRepo) CheckConnection

func (r *CourseLessonRepo) CheckConnection() error

func (*CourseLessonRepo) Close

func (r *CourseLessonRepo) Close()

func (*CourseLessonRepo) Connect

func (r *CourseLessonRepo) Connect(
	ctx context.Context,
	courseLesson *data.CourseLesson,
) (*CourseLessonPermit, error)

func (*CourseLessonRepo) CountByCourse

func (r *CourseLessonRepo) CountByCourse(
	ctx context.Context,
	courseID string,
) (int32, error)

func (*CourseLessonRepo) Disconnect

func (r *CourseLessonRepo) Disconnect(
	ctx context.Context,
	courseLesson *data.CourseLesson,
) error

func (*CourseLessonRepo) Get

func (r *CourseLessonRepo) Get(
	ctx context.Context,
	lessonID string,
) (*CourseLessonPermit, error)

func (*CourseLessonRepo) GetByCourse

func (r *CourseLessonRepo) GetByCourse(
	ctx context.Context,
	courseID string,
	po *data.PageOptions,
) ([]*CourseLessonPermit, error)

func (*CourseLessonRepo) GetByCourseAndNumber

func (r *CourseLessonRepo) GetByCourseAndNumber(
	ctx context.Context,
	courseID string,
	number int32,
) (*CourseLessonPermit, error)

func (*CourseLessonRepo) Move

func (r *CourseLessonRepo) Move(
	ctx context.Context,
	courseLesson *data.CourseLesson,
	afterLessonID string,
) (*data.CourseLesson, error)

func (*CourseLessonRepo) Open

func (r *CourseLessonRepo) Open(p *Permitter) error

type CoursePermit

type CoursePermit struct {
	// contains filtered or unexported fields
}

func (*CoursePermit) AdvancedAt

func (r *CoursePermit) AdvancedAt() (*time.Time, error)

func (*CoursePermit) AppledAt

func (r *CoursePermit) AppledAt() time.Time

func (*CoursePermit) CompletedAt

func (r *CoursePermit) CompletedAt() (*time.Time, error)

func (*CoursePermit) CreatedAt

func (r *CoursePermit) CreatedAt() (time.Time, error)

func (*CoursePermit) Description

func (r *CoursePermit) Description() (string, error)

func (*CoursePermit) Get

func (r *CoursePermit) Get() *data.Course

func (*CoursePermit) ID

func (r *CoursePermit) ID() (*mytype.OID, error)

func (*CoursePermit) IsPublished

func (r *CoursePermit) IsPublished() (bool, error)

func (*CoursePermit) Name

func (r *CoursePermit) Name() (string, error)

func (*CoursePermit) Number

func (r *CoursePermit) Number() (int32, error)

func (*CoursePermit) PublishedAt

func (r *CoursePermit) PublishedAt() (*time.Time, error)

func (*CoursePermit) Status

func (r *CoursePermit) Status() (*mytype.CourseStatus, error)

func (*CoursePermit) StudyID

func (r *CoursePermit) StudyID() (*mytype.OID, error)

func (*CoursePermit) TopicedAt

func (r *CoursePermit) TopicedAt() time.Time

func (*CoursePermit) UpdatedAt

func (r *CoursePermit) UpdatedAt() (time.Time, error)

func (*CoursePermit) UserID

func (r *CoursePermit) UserID() (*mytype.OID, error)

type CourseRepo

type CourseRepo struct {
	// contains filtered or unexported fields
}

func NewCourseRepo

func NewCourseRepo(conf *myconf.Config) *CourseRepo

func (*CourseRepo) CheckConnection

func (r *CourseRepo) CheckConnection() error

func (*CourseRepo) Close

func (r *CourseRepo) Close()

func (*CourseRepo) CountByApplee

func (r *CourseRepo) CountByApplee(
	ctx context.Context,
	appleeID string,
	filters *data.CourseFilterOptions,
) (int32, error)

func (*CourseRepo) CountBySearch

func (r *CourseRepo) CountBySearch(
	ctx context.Context,
	filters *data.CourseFilterOptions,
) (int32, error)

func (*CourseRepo) CountByStudy

func (r *CourseRepo) CountByStudy(
	ctx context.Context,
	studyID string,
	filters *data.CourseFilterOptions,
) (int32, error)

func (*CourseRepo) CountByTopic

func (r *CourseRepo) CountByTopic(
	ctx context.Context,
	topicID string,
	filters *data.CourseFilterOptions,
) (int32, error)

func (*CourseRepo) CountByUser

func (r *CourseRepo) CountByUser(
	ctx context.Context,
	userID string,
	filters *data.CourseFilterOptions,
) (int32, error)

func (*CourseRepo) Create

func (r *CourseRepo) Create(
	ctx context.Context,
	c *data.Course,
) (*CoursePermit, error)

func (*CourseRepo) Delete

func (r *CourseRepo) Delete(
	ctx context.Context,
	course *data.Course,
) error

func (*CourseRepo) Get

func (r *CourseRepo) Get(
	ctx context.Context,
	id string,
) (*CoursePermit, error)

func (*CourseRepo) GetByApplee

func (r *CourseRepo) GetByApplee(
	ctx context.Context,
	appleeID string,
	po *data.PageOptions,
	filters *data.CourseFilterOptions,
) ([]*CoursePermit, error)

func (*CourseRepo) GetByName

func (r *CourseRepo) GetByName(
	ctx context.Context,
	studyID,
	name string,
) (*CoursePermit, error)

func (*CourseRepo) GetByNumber

func (r *CourseRepo) GetByNumber(
	ctx context.Context,
	studyID string,
	number int32,
) (*CoursePermit, error)

func (*CourseRepo) GetByStudy

func (r *CourseRepo) GetByStudy(
	ctx context.Context,
	studyID string,
	po *data.PageOptions,
	filters *data.CourseFilterOptions,
) ([]*CoursePermit, error)

func (*CourseRepo) GetByStudyAndName

func (r *CourseRepo) GetByStudyAndName(
	ctx context.Context,
	study,
	name string,
) (*CoursePermit, error)

func (*CourseRepo) GetByTopic

func (r *CourseRepo) GetByTopic(
	ctx context.Context,
	topicID string,
	po *data.PageOptions,
	filters *data.CourseFilterOptions,
) ([]*CoursePermit, error)

func (*CourseRepo) GetByUser

func (r *CourseRepo) GetByUser(
	ctx context.Context,
	userID string,
	po *data.PageOptions,
	filters *data.CourseFilterOptions,
) ([]*CoursePermit, error)

func (*CourseRepo) IsPublishable

func (r *CourseRepo) IsPublishable(
	ctx context.Context,
	id string,
) (bool, error)

func (*CourseRepo) Open

func (r *CourseRepo) Open(p *Permitter) error

func (*CourseRepo) Pull

func (r *CourseRepo) Pull(
	ctx context.Context,
	id string,
) (*CoursePermit, error)

func (*CourseRepo) Search

func (r *CourseRepo) Search(
	ctx context.Context,
	po *data.PageOptions,
	filters *data.CourseFilterOptions,
) ([]*CoursePermit, error)

func (*CourseRepo) Update

func (r *CourseRepo) Update(
	ctx context.Context,
	c *data.Course,
) (*CoursePermit, error)

func (*CourseRepo) ViewerCanAdmin

func (r *CourseRepo) ViewerCanAdmin(
	ctx context.Context,
	c *data.Course,
) (bool, error)

type EVTPermit

type EVTPermit struct {
	// contains filtered or unexported fields
}

func (*EVTPermit) EmailID

func (r *EVTPermit) EmailID() (*mytype.OID, error)

func (*EVTPermit) ExpiresAt

func (r *EVTPermit) ExpiresAt() (time.Time, error)

func (*EVTPermit) Get

func (r *EVTPermit) Get() *data.EVT

func (*EVTPermit) IssuedAt

func (r *EVTPermit) IssuedAt() (time.Time, error)

func (*EVTPermit) Token

func (r *EVTPermit) Token() (string, error)

func (*EVTPermit) UserID

func (r *EVTPermit) UserID() (*mytype.OID, error)

func (*EVTPermit) VerifiedAt

func (r *EVTPermit) VerifiedAt() (time.Time, error)

type EVTRepo

type EVTRepo struct {
	// contains filtered or unexported fields
}

func NewEVTRepo

func NewEVTRepo(conf *myconf.Config) *EVTRepo

func (*EVTRepo) CheckConnection

func (r *EVTRepo) CheckConnection() error

func (*EVTRepo) Close

func (r *EVTRepo) Close()

func (*EVTRepo) Create

func (r *EVTRepo) Create(
	ctx context.Context,
	token *data.EVT,
) (*EVTPermit, error)

func (*EVTRepo) Get

func (r *EVTRepo) Get(
	ctx context.Context,
	emailID,
	token string,
) (*EVTPermit, error)

func (*EVTRepo) Open

func (r *EVTRepo) Open(p *Permitter) error

type EmailPermit

type EmailPermit struct {
	// contains filtered or unexported fields
}

func (*EmailPermit) CreatedAt

func (r *EmailPermit) CreatedAt() (time.Time, error)

func (*EmailPermit) Get

func (r *EmailPermit) Get() *data.Email

func (*EmailPermit) ID

func (r *EmailPermit) ID() (*mytype.OID, error)

func (*EmailPermit) IsVerified

func (r *EmailPermit) IsVerified() (bool, error)

func (*EmailPermit) Type

func (r *EmailPermit) Type() (string, error)

func (*EmailPermit) UpdatedAt

func (r *EmailPermit) UpdatedAt() (time.Time, error)

func (*EmailPermit) UserID

func (r *EmailPermit) UserID() (*mytype.OID, error)

func (*EmailPermit) Value

func (r *EmailPermit) Value() (string, error)

func (*EmailPermit) VerifiedAt

func (r *EmailPermit) VerifiedAt() (*time.Time, error)

type EmailRepo

type EmailRepo struct {
	// contains filtered or unexported fields
}

func NewEmailRepo

func NewEmailRepo(conf *myconf.Config) *EmailRepo

func (*EmailRepo) CheckConnection

func (r *EmailRepo) CheckConnection() error

func (*EmailRepo) Close

func (r *EmailRepo) Close()

func (*EmailRepo) CountByUser

func (r *EmailRepo) CountByUser(
	ctx context.Context,
	userID string,
	filters *data.EmailFilterOptions,
) (int32, error)

func (*EmailRepo) Create

func (r *EmailRepo) Create(
	ctx context.Context,
	e *data.Email,
) (*EmailPermit, error)

func (*EmailRepo) Delete

func (r *EmailRepo) Delete(
	ctx context.Context,
	email *data.Email,
) error

func (*EmailRepo) Get

func (r *EmailRepo) Get(
	ctx context.Context,
	id string,
) (*EmailPermit, error)

func (*EmailRepo) GetByUser

func (r *EmailRepo) GetByUser(
	ctx context.Context,
	userID string,
	po *data.PageOptions,
	filters *data.EmailFilterOptions,
) ([]*EmailPermit, error)

func (*EmailRepo) GetByValue

func (r *EmailRepo) GetByValue(
	ctx context.Context,
	value string,
) (*EmailPermit, error)

func (*EmailRepo) Open

func (r *EmailRepo) Open(p *Permitter) error

func (*EmailRepo) Update

func (r *EmailRepo) Update(
	ctx context.Context,
	e *data.Email,
) (*EmailPermit, error)

func (*EmailRepo) ViewerCanDelete

func (r *EmailRepo) ViewerCanDelete(
	ctx context.Context,
	e *data.Email,
) bool

type EnrollablePermit

type EnrollablePermit interface {
	EnrolledAt() time.Time
	ID() (*mytype.OID, error)
}

type EnrolledPermit

type EnrolledPermit struct {
	// contains filtered or unexported fields
}

func (*EnrolledPermit) CreatedAt

func (r *EnrolledPermit) CreatedAt() (time.Time, error)

func (*EnrolledPermit) EnrollableID

func (r *EnrolledPermit) EnrollableID() (*mytype.OID, error)

func (*EnrolledPermit) Get

func (r *EnrolledPermit) Get() *data.Enrolled

func (*EnrolledPermit) ID

func (r *EnrolledPermit) ID() (int32, error)

func (*EnrolledPermit) Status

func (r *EnrolledPermit) Status() (*mytype.EnrollmentStatus, error)

func (*EnrolledPermit) UserID

func (r *EnrolledPermit) UserID() (*mytype.OID, error)

type EnrolledRepo

type EnrolledRepo struct {
	// contains filtered or unexported fields
}

func NewEnrolledRepo

func NewEnrolledRepo(conf *myconf.Config) *EnrolledRepo

func (*EnrolledRepo) CheckConnection

func (r *EnrolledRepo) CheckConnection() error

func (*EnrolledRepo) Close

func (r *EnrolledRepo) Close()

func (*EnrolledRepo) Connect

func (r *EnrolledRepo) Connect(
	ctx context.Context,
	enrolled *data.Enrolled,
) (*EnrolledPermit, error)

func (*EnrolledRepo) CountByEnrollable

func (r *EnrolledRepo) CountByEnrollable(
	ctx context.Context,
	enrollableID string,
	filters *data.EnrolledFilterOptions,
) (int32, error)

func (*EnrolledRepo) CountByUser

func (r *EnrolledRepo) CountByUser(
	ctx context.Context,
	userID string,
	filters *data.EnrolledFilterOptions,
) (int32, error)

func (*EnrolledRepo) Disconnect

func (r *EnrolledRepo) Disconnect(
	ctx context.Context,
	enrolled *data.Enrolled,
) error

func (*EnrolledRepo) Get

func (r *EnrolledRepo) Get(
	ctx context.Context,
	e *data.Enrolled,
) (*EnrolledPermit, error)

func (*EnrolledRepo) GetByEnrollable

func (r *EnrolledRepo) GetByEnrollable(
	ctx context.Context,
	enrollableID string,
	po *data.PageOptions,
	filters *data.EnrolledFilterOptions,
) ([]*EnrolledPermit, error)

func (*EnrolledRepo) GetByUser

func (r *EnrolledRepo) GetByUser(
	ctx context.Context,
	userID string,
	po *data.PageOptions,
	filters *data.EnrolledFilterOptions,
) ([]*EnrolledPermit, error)

func (*EnrolledRepo) Open

func (r *EnrolledRepo) Open(p *Permitter) error

func (*EnrolledRepo) Pull

func (r *EnrolledRepo) Pull(
	ctx context.Context,
	e *data.Enrolled,
) (*EnrolledPermit, error)

Same as Get(), but doesn't use the dataloader, so it always requests from the db.

func (*EnrolledRepo) Update

func (r *EnrolledRepo) Update(
	ctx context.Context,
	e *data.Enrolled,
) (*EnrolledPermit, error)

func (*EnrolledRepo) ViewerCanEnroll

func (r *EnrolledRepo) ViewerCanEnroll(
	ctx context.Context,
	e *data.Enrolled,
) (bool, error)

type EventPermit

type EventPermit struct {
	// contains filtered or unexported fields
}

func (*EventPermit) CreatedAt

func (r *EventPermit) CreatedAt() (time.Time, error)

func (*EventPermit) Get

func (r *EventPermit) Get() *data.Event

func (*EventPermit) ID

func (r *EventPermit) ID() (*mytype.OID, error)

func (*EventPermit) Payload

func (r *EventPermit) Payload() (*pgtype.JSONB, error)

func (*EventPermit) Public

func (r *EventPermit) Public() (bool, error)

func (*EventPermit) StudyID

func (r *EventPermit) StudyID() (*mytype.OID, error)

func (*EventPermit) Type

func (r *EventPermit) Type() (string, error)

func (*EventPermit) UserID

func (r *EventPermit) UserID() (*mytype.OID, error)

type EventRepo

type EventRepo struct {
	// contains filtered or unexported fields
}

func NewEventRepo

func NewEventRepo(conf *myconf.Config) *EventRepo

func (*EventRepo) CheckConnection

func (r *EventRepo) CheckConnection() error

func (*EventRepo) Close

func (r *EventRepo) Close()

func (*EventRepo) CountByLesson

func (r *EventRepo) CountByLesson(
	ctx context.Context,
	lessonID string,
	filters *data.EventFilterOptions,
) (int32, error)

func (*EventRepo) CountByStudy

func (r *EventRepo) CountByStudy(
	ctx context.Context,
	studyID string,
	filters *data.EventFilterOptions,
) (int32, error)

func (*EventRepo) CountByUser

func (r *EventRepo) CountByUser(
	ctx context.Context,
	userID string,
	filters *data.EventFilterOptions,
) (int32, error)

func (*EventRepo) CountByUserAsset

func (r *EventRepo) CountByUserAsset(
	ctx context.Context,
	assetID string,
	filters *data.EventFilterOptions,
) (int32, error)

func (*EventRepo) CountReceivedByUser

func (r *EventRepo) CountReceivedByUser(
	ctx context.Context,
	userID string,
	filters *data.EventFilterOptions,
) (int32, error)

func (*EventRepo) Create

func (r *EventRepo) Create(
	ctx context.Context,
	event *data.Event,
) (*EventPermit, error)

func (*EventRepo) Delete

func (r *EventRepo) Delete(
	ctx context.Context,
	event *data.Event,
) error

func (*EventRepo) Get

func (r *EventRepo) Get(
	ctx context.Context,
	id string,
) (*EventPermit, error)

func (*EventRepo) GetByLesson

func (r *EventRepo) GetByLesson(
	ctx context.Context,
	lessonID string,
	po *data.PageOptions,
	filters *data.EventFilterOptions,
) ([]*EventPermit, error)

func (*EventRepo) GetByStudy

func (r *EventRepo) GetByStudy(
	ctx context.Context,
	studyID string,
	po *data.PageOptions,
	filters *data.EventFilterOptions,
) ([]*EventPermit, error)

func (*EventRepo) GetByUser

func (r *EventRepo) GetByUser(
	ctx context.Context,
	userID string,
	po *data.PageOptions,
	filters *data.EventFilterOptions,
) ([]*EventPermit, error)

func (*EventRepo) GetByUserAsset

func (r *EventRepo) GetByUserAsset(
	ctx context.Context,
	userID string,
	po *data.PageOptions,
	filters *data.EventFilterOptions,
) ([]*EventPermit, error)

func (*EventRepo) GetReceivedByUser

func (r *EventRepo) GetReceivedByUser(
	ctx context.Context,
	userID string,
	po *data.PageOptions,
	filters *data.EventFilterOptions,
) ([]*EventPermit, error)

func (*EventRepo) Open

func (r *EventRepo) Open(p *Permitter) error

type FieldPermissionFunc

type FieldPermissionFunc = func(field string) bool
var AdminPermissionFunc FieldPermissionFunc = func(field string) bool { return true }

type LabelPermit

type LabelPermit struct {
	// contains filtered or unexported fields
}

func (*LabelPermit) Color

func (r *LabelPermit) Color() (string, error)

func (*LabelPermit) CreatedAt

func (r *LabelPermit) CreatedAt() (time.Time, error)

func (*LabelPermit) Description

func (r *LabelPermit) Description() (string, error)

func (*LabelPermit) Get

func (r *LabelPermit) Get() *data.Label

func (*LabelPermit) ID

func (r *LabelPermit) ID() (*mytype.OID, error)

func (*LabelPermit) IsDefault

func (r *LabelPermit) IsDefault() (bool, error)

func (*LabelPermit) Name

func (r *LabelPermit) Name() (string, error)

func (*LabelPermit) StudyID

func (r *LabelPermit) StudyID() (*mytype.OID, error)

func (*LabelPermit) UpdatedAt

func (r *LabelPermit) UpdatedAt() (time.Time, error)

type LabelRepo

type LabelRepo struct {
	// contains filtered or unexported fields
}

func NewLabelRepo

func NewLabelRepo(conf *myconf.Config) *LabelRepo

func (*LabelRepo) CheckConnection

func (r *LabelRepo) CheckConnection() error

func (*LabelRepo) Close

func (r *LabelRepo) Close()

func (*LabelRepo) CountByLabelable

func (r *LabelRepo) CountByLabelable(
	ctx context.Context,
	labelableID string,
	filters *data.LabelFilterOptions,
) (int32, error)

func (*LabelRepo) CountBySearch

func (r *LabelRepo) CountBySearch(
	ctx context.Context,
	filters *data.LabelFilterOptions,
) (int32, error)

func (*LabelRepo) CountByStudy

func (r *LabelRepo) CountByStudy(
	ctx context.Context,
	studyID string,
	filters *data.LabelFilterOptions,
) (int32, error)

func (*LabelRepo) Create

func (r *LabelRepo) Create(
	ctx context.Context,
	l *data.Label,
) (*LabelPermit, error)

func (*LabelRepo) Delete

func (r *LabelRepo) Delete(
	ctx context.Context,
	label *data.Label,
) error

func (*LabelRepo) Get

func (r *LabelRepo) Get(
	ctx context.Context,
	id string,
) (*LabelPermit, error)

func (*LabelRepo) GetByLabelable

func (r *LabelRepo) GetByLabelable(
	ctx context.Context,
	labelableID string,
	po *data.PageOptions,
	filters *data.LabelFilterOptions,
) ([]*LabelPermit, error)

func (*LabelRepo) GetByName

func (r *LabelRepo) GetByName(
	ctx context.Context,
	studyID,
	name string,
) (*LabelPermit, error)

func (*LabelRepo) GetByStudy

func (r *LabelRepo) GetByStudy(
	ctx context.Context,
	studyID string,
	po *data.PageOptions,
	filters *data.LabelFilterOptions,
) ([]*LabelPermit, error)

func (*LabelRepo) Open

func (r *LabelRepo) Open(p *Permitter) error

func (*LabelRepo) Search

func (r *LabelRepo) Search(
	ctx context.Context,
	po *data.PageOptions,
	filters *data.LabelFilterOptions,
) ([]*LabelPermit, error)

func (*LabelRepo) Update

func (r *LabelRepo) Update(
	ctx context.Context,
	l *data.Label,
) (*LabelPermit, error)

func (*LabelRepo) ViewerCanDelete

func (r *LabelRepo) ViewerCanDelete(
	ctx context.Context,
	l *data.Label,
) bool

func (*LabelRepo) ViewerCanUpdate

func (r *LabelRepo) ViewerCanUpdate(
	ctx context.Context,
	l *data.Label,
) bool

type LabelablePermit

type LabelablePermit interface {
	ID() (*mytype.OID, error)
	LabeledAt() time.Time
}

type LabeledPermit

type LabeledPermit struct {
	// contains filtered or unexported fields
}

func (*LabeledPermit) CreatedAt

func (r *LabeledPermit) CreatedAt() (time.Time, error)

func (*LabeledPermit) Get

func (r *LabeledPermit) Get() *data.Labeled

func (*LabeledPermit) ID

func (r *LabeledPermit) ID() (int32, error)

func (*LabeledPermit) LabelID

func (r *LabeledPermit) LabelID() (*mytype.OID, error)

func (*LabeledPermit) LabelableID

func (r *LabeledPermit) LabelableID() (*mytype.OID, error)

type LabeledRepo

type LabeledRepo struct {
	// contains filtered or unexported fields
}

func NewLabeledRepo

func NewLabeledRepo(conf *myconf.Config) *LabeledRepo

func (*LabeledRepo) CheckConnection

func (r *LabeledRepo) CheckConnection() error

func (*LabeledRepo) Close

func (r *LabeledRepo) Close()

func (*LabeledRepo) Connect

func (r *LabeledRepo) Connect(
	ctx context.Context,
	labeled *data.Labeled,
) (*LabeledPermit, error)

func (*LabeledRepo) CountByLabel

func (r *LabeledRepo) CountByLabel(
	ctx context.Context,
	labelID string,
) (int32, error)

func (*LabeledRepo) CountByLabelable

func (r *LabeledRepo) CountByLabelable(
	ctx context.Context,
	labelableID string,
) (int32, error)

func (*LabeledRepo) Disconnect

func (r *LabeledRepo) Disconnect(
	ctx context.Context,
	l *data.Labeled,
) error

func (*LabeledRepo) Get

func (r *LabeledRepo) Get(
	ctx context.Context,
	l *data.Labeled,
) (*LabeledPermit, error)

func (*LabeledRepo) GetByLabel

func (r *LabeledRepo) GetByLabel(
	ctx context.Context,
	labelID string,
	po *data.PageOptions,
) ([]*LabeledPermit, error)

func (*LabeledRepo) GetByLabelable

func (r *LabeledRepo) GetByLabelable(
	ctx context.Context,
	labelableID string,
	po *data.PageOptions,
) ([]*LabeledPermit, error)

func (*LabeledRepo) Open

func (r *LabeledRepo) Open(p *Permitter) error

type LessonDraftBackupPermit

type LessonDraftBackupPermit struct {
	// contains filtered or unexported fields
}

func (*LessonDraftBackupPermit) CreatedAt

func (r *LessonDraftBackupPermit) CreatedAt() (time.Time, error)

func (*LessonDraftBackupPermit) Draft

func (r *LessonDraftBackupPermit) Draft() (string, error)

func (*LessonDraftBackupPermit) Get

func (*LessonDraftBackupPermit) ID

func (r *LessonDraftBackupPermit) ID() (int32, error)

func (*LessonDraftBackupPermit) LessonID

func (r *LessonDraftBackupPermit) LessonID() (*mytype.OID, error)

func (*LessonDraftBackupPermit) UpdatedAt

func (r *LessonDraftBackupPermit) UpdatedAt() (time.Time, error)

type LessonDraftBackupRepo

type LessonDraftBackupRepo struct {
	// contains filtered or unexported fields
}

func NewLessonDraftBackupRepo

func NewLessonDraftBackupRepo(conf *myconf.Config) *LessonDraftBackupRepo

func (*LessonDraftBackupRepo) CheckConnection

func (r *LessonDraftBackupRepo) CheckConnection() error

func (*LessonDraftBackupRepo) Clear

func (r *LessonDraftBackupRepo) Clear(id string)

func (*LessonDraftBackupRepo) Close

func (r *LessonDraftBackupRepo) Close()

func (*LessonDraftBackupRepo) Get

func (*LessonDraftBackupRepo) GetByLesson

func (r *LessonDraftBackupRepo) GetByLesson(
	ctx context.Context,
	lessonID string,
) ([]*LessonDraftBackupPermit, error)

func (*LessonDraftBackupRepo) Open

func (*LessonDraftBackupRepo) Pull

Same as Get(), but doesn't use the dataloader

func (*LessonDraftBackupRepo) Restore

func (r *LessonDraftBackupRepo) Restore(
	ctx context.Context,
	lesson *data.Lesson,
	backupID int32,
) error

type LessonPermit

type LessonPermit struct {
	// contains filtered or unexported fields
}

func (*LessonPermit) Body

func (r *LessonPermit) Body() (*mytype.Markdown, error)

func (*LessonPermit) CourseID

func (r *LessonPermit) CourseID() (*mytype.OID, error)

func (*LessonPermit) CourseNumber

func (r *LessonPermit) CourseNumber() (*int32, error)

func (*LessonPermit) CreatedAt

func (r *LessonPermit) CreatedAt() (time.Time, error)

func (*LessonPermit) Draft

func (r *LessonPermit) Draft() (string, error)

func (*LessonPermit) Get

func (r *LessonPermit) Get() *data.Lesson

func (*LessonPermit) ID

func (r *LessonPermit) ID() (*mytype.OID, error)

func (*LessonPermit) IsPublished

func (r *LessonPermit) IsPublished() (bool, error)

func (*LessonPermit) LastEditedAt

func (r *LessonPermit) LastEditedAt() (time.Time, error)

func (*LessonPermit) Number

func (r *LessonPermit) Number() (int32, error)

func (*LessonPermit) PublishedAt

func (r *LessonPermit) PublishedAt() (time.Time, error)

func (*LessonPermit) StudyID

func (r *LessonPermit) StudyID() (*mytype.OID, error)

func (*LessonPermit) Title

func (r *LessonPermit) Title() (string, error)

func (*LessonPermit) UpdatedAt

func (r *LessonPermit) UpdatedAt() (time.Time, error)

func (*LessonPermit) UserID

func (r *LessonPermit) UserID() (*mytype.OID, error)

type LessonRepo

type LessonRepo struct {
	// contains filtered or unexported fields
}

func NewLessonRepo

func NewLessonRepo(conf *myconf.Config) *LessonRepo

func (*LessonRepo) BatchGetByNumber

func (r *LessonRepo) BatchGetByNumber(
	ctx context.Context,
	studyID string,
	numbers []int32,
) ([]*LessonPermit, error)

func (*LessonRepo) CheckConnection

func (r *LessonRepo) CheckConnection() error

func (*LessonRepo) Clear

func (r *LessonRepo) Clear(id string)

func (*LessonRepo) Close

func (r *LessonRepo) Close()

func (*LessonRepo) CountByCourse

func (r *LessonRepo) CountByCourse(
	ctx context.Context,
	courseID string,
	filters *data.LessonFilterOptions,
) (int32, error)

func (*LessonRepo) CountByEnrollee

func (r *LessonRepo) CountByEnrollee(
	ctx context.Context,
	userID string,
	filters *data.LessonFilterOptions,
) (int32, error)

func (*LessonRepo) CountByLabel

func (r *LessonRepo) CountByLabel(
	ctx context.Context,
	labelID string,
	filters *data.LessonFilterOptions,
) (int32, error)

func (*LessonRepo) CountBySearch

func (r *LessonRepo) CountBySearch(
	ctx context.Context,
	filters *data.LessonFilterOptions,
) (int32, error)

func (*LessonRepo) CountByStudy

func (r *LessonRepo) CountByStudy(
	ctx context.Context,
	studyID string,
	filters *data.LessonFilterOptions,
) (int32, error)

func (*LessonRepo) CountByUser

func (r *LessonRepo) CountByUser(
	ctx context.Context,
	userID string,
	filters *data.LessonFilterOptions,
) (int32, error)

func (*LessonRepo) Create

func (r *LessonRepo) Create(
	ctx context.Context,
	l *data.Lesson,
) (*LessonPermit, error)

func (*LessonRepo) Delete

func (r *LessonRepo) Delete(
	ctx context.Context,
	lesson *data.Lesson,
) error

func (*LessonRepo) Exists

func (r *LessonRepo) Exists(
	ctx context.Context,
	id string,
) (bool, error)

func (*LessonRepo) ExistsByNumber

func (r *LessonRepo) ExistsByNumber(
	ctx context.Context,
	studyID string,
	number int32,
) (bool, error)

func (*LessonRepo) ExistsByOwnerStudyAndNumber

func (r *LessonRepo) ExistsByOwnerStudyAndNumber(
	ctx context.Context,
	ownerLogin,
	studyName string,
	number int32,
) (bool, error)

func (*LessonRepo) Get

func (r *LessonRepo) Get(
	ctx context.Context,
	id string,
) (*LessonPermit, error)

func (*LessonRepo) GetByCourse

func (r *LessonRepo) GetByCourse(
	ctx context.Context,
	courseID string,
	po *data.PageOptions,
	filters *data.LessonFilterOptions,
) ([]*LessonPermit, error)

func (*LessonRepo) GetByCourseNumber

func (r *LessonRepo) GetByCourseNumber(
	ctx context.Context,
	courseID string,
	courseNumber int32,
) (*LessonPermit, error)

func (*LessonRepo) GetByEnrollee

func (r *LessonRepo) GetByEnrollee(
	ctx context.Context,
	userID string,
	po *data.PageOptions,
	filters *data.LessonFilterOptions,
) ([]*LessonPermit, error)

func (*LessonRepo) GetByLabel

func (r *LessonRepo) GetByLabel(
	ctx context.Context,
	labelID string,
	po *data.PageOptions,
	filters *data.LessonFilterOptions,
) ([]*LessonPermit, error)

func (*LessonRepo) GetByNumber

func (r *LessonRepo) GetByNumber(
	ctx context.Context,
	studyID string,
	number int32,
) (*LessonPermit, error)

func (*LessonRepo) GetByOwnerStudyAndNumber

func (r *LessonRepo) GetByOwnerStudyAndNumber(
	ctx context.Context,
	owner,
	study string,
	number int32,
) (*LessonPermit, error)

func (*LessonRepo) GetByStudy

func (r *LessonRepo) GetByStudy(
	ctx context.Context,
	studyID string,
	po *data.PageOptions,
	filters *data.LessonFilterOptions,
) ([]*LessonPermit, error)

func (*LessonRepo) GetByUser

func (r *LessonRepo) GetByUser(
	ctx context.Context,
	userID string,
	po *data.PageOptions,
	filters *data.LessonFilterOptions,
) ([]*LessonPermit, error)

func (*LessonRepo) Open

func (r *LessonRepo) Open(p *Permitter) error

func (*LessonRepo) Pull

func (r *LessonRepo) Pull(
	ctx context.Context,
	id string,
) (*LessonPermit, error)

Same as Get(), but doesn't use the dataloader

func (*LessonRepo) Search

func (r *LessonRepo) Search(
	ctx context.Context,
	po *data.PageOptions,
	filters *data.LessonFilterOptions,
) ([]*LessonPermit, error)

func (*LessonRepo) Update

func (r *LessonRepo) Update(
	ctx context.Context,
	l *data.Lesson,
) (*LessonPermit, error)

func (*LessonRepo) ViewerCanDelete

func (r *LessonRepo) ViewerCanDelete(
	ctx context.Context,
	l *data.Lesson,
) bool

func (*LessonRepo) ViewerCanUpdate

func (r *LessonRepo) ViewerCanUpdate(
	ctx context.Context,
	l *data.Lesson,
) bool

type NodePermit

type NodePermit interface {
	ID() (*mytype.OID, error)
}

type NotificationPermit

type NotificationPermit struct {
	// contains filtered or unexported fields
}

func (*NotificationPermit) CreatedAt

func (r *NotificationPermit) CreatedAt() (time.Time, error)

func (*NotificationPermit) Get

func (*NotificationPermit) ID

func (r *NotificationPermit) ID() (*mytype.OID, error)

func (*NotificationPermit) LastReadAt

func (r *NotificationPermit) LastReadAt() (time.Time, error)

func (*NotificationPermit) Reason

func (r *NotificationPermit) Reason() (string, error)

func (*NotificationPermit) StudyID

func (r *NotificationPermit) StudyID() (*mytype.OID, error)

func (*NotificationPermit) Subject

func (r *NotificationPermit) Subject() (string, error)

func (*NotificationPermit) SubjectID

func (r *NotificationPermit) SubjectID() (*mytype.OID, error)

func (*NotificationPermit) Unread

func (r *NotificationPermit) Unread() (bool, error)

func (*NotificationPermit) UpdatedAt

func (r *NotificationPermit) UpdatedAt() (time.Time, error)

func (*NotificationPermit) UserID

func (r *NotificationPermit) UserID() (*mytype.OID, error)

type NotificationRepo

type NotificationRepo struct {
	// contains filtered or unexported fields
}

func NewNotificationRepo

func NewNotificationRepo(conf *myconf.Config) *NotificationRepo

func (*NotificationRepo) CheckConnection

func (r *NotificationRepo) CheckConnection() error

func (*NotificationRepo) Close

func (r *NotificationRepo) Close()

func (*NotificationRepo) CountByStudy

func (r *NotificationRepo) CountByStudy(
	ctx context.Context,
	studyID string,
) (int32, error)

func (*NotificationRepo) CountByUser

func (r *NotificationRepo) CountByUser(
	ctx context.Context,
	userID string,
) (int32, error)

func (*NotificationRepo) Create

func (r *NotificationRepo) Create(
	ctx context.Context,
	notification *data.Notification,
) (*NotificationPermit, error)

func (*NotificationRepo) Delete

func (r *NotificationRepo) Delete(
	ctx context.Context,
	n *data.Notification,
) error

func (*NotificationRepo) DeleteByStudy

func (r *NotificationRepo) DeleteByStudy(
	ctx context.Context,
	n *data.Notification,
) error

func (*NotificationRepo) DeleteByUser

func (r *NotificationRepo) DeleteByUser(
	ctx context.Context,
	n *data.Notification,
) error

func (*NotificationRepo) Get

func (*NotificationRepo) GetByStudy

func (r *NotificationRepo) GetByStudy(
	ctx context.Context,
	studyID string,
	po *data.PageOptions,
) ([]*NotificationPermit, error)

func (*NotificationRepo) GetByUser

func (r *NotificationRepo) GetByUser(
	ctx context.Context,
	userID string,
	po *data.PageOptions,
) ([]*NotificationPermit, error)

func (*NotificationRepo) Open

func (r *NotificationRepo) Open(p *Permitter) error

type PRTPermit

type PRTPermit struct {
	// contains filtered or unexported fields
}

func (*PRTPermit) EmailID

func (r *PRTPermit) EmailID() (*mytype.OID, error)

func (*PRTPermit) EndedAt

func (r *PRTPermit) EndedAt() (time.Time, error)

func (*PRTPermit) ExpiresAt

func (r *PRTPermit) ExpiresAt() (time.Time, error)

func (*PRTPermit) Get

func (r *PRTPermit) Get() *data.PRT

func (*PRTPermit) IssuedAt

func (r *PRTPermit) IssuedAt() (time.Time, error)

func (*PRTPermit) Token

func (r *PRTPermit) Token() (string, error)

func (*PRTPermit) UserID

func (r *PRTPermit) UserID() (*mytype.OID, error)

type PRTRepo

type PRTRepo struct {
	// contains filtered or unexported fields
}

func NewPRTRepo

func NewPRTRepo(conf *myconf.Config) *PRTRepo

func (*PRTRepo) CheckConnection

func (r *PRTRepo) CheckConnection() error

func (*PRTRepo) Close

func (r *PRTRepo) Close()

func (*PRTRepo) Create

func (r *PRTRepo) Create(
	ctx context.Context,
	t *data.PRT,
) (*PRTPermit, error)

func (*PRTRepo) Get

func (r *PRTRepo) Get(
	ctx context.Context,
	userID,
	token string,
) (*PRTPermit, error)

func (*PRTRepo) Open

func (r *PRTRepo) Open(p *Permitter) error

func (*PRTRepo) Update

func (r *PRTRepo) Update(
	ctx context.Context,
	token *data.PRT,
) (*PRTPermit, error)

type Permitter

type Permitter struct {
	// contains filtered or unexported fields
}

func NewPermitter

func NewPermitter(repos *Repos, conf *myconf.Config) *Permitter

func (*Permitter) Check

func (r *Permitter) Check(
	ctx context.Context,
	a mytype.AccessLevel,
	node interface{},
) (FieldPermissionFunc, error)

func (*Permitter) CheckConnection

func (r *Permitter) CheckConnection() error

func (*Permitter) ClearCache

func (r *Permitter) ClearCache()

func (*Permitter) ClearCacheOperation

func (r *Permitter) ClearCacheOperation(o mytype.Operation)

func (*Permitter) ViewerCanAdmin

func (r *Permitter) ViewerCanAdmin(
	ctx context.Context,
	node interface{},
) (bool, error)

Can the viewer admin the node, i.e. is the viewer the owner of the object?

func (*Permitter) ViewerCanCreateWithOwnership

func (r *Permitter) ViewerCanCreateWithOwnership(
	ctx context.Context,
	node interface{},
) (bool, error)

Can the viewer create the passed node with the Owner role? Mainly used for objects that have parent objects, and the viewer must be the owner of the parent object to create a child object.

func (*Permitter) ViewerCanRead

func (r *Permitter) ViewerCanRead(
	ctx context.Context,
	node interface{},
) (bool, error)

Can the viewer read the node?

type Repo

type Repo interface {
	Open(*Permitter) error
	Close()
}

type Repos

type Repos struct {
	// contains filtered or unexported fields
}

func NewRepos

func NewRepos(db data.Queryer, conf *myconf.Config) *Repos

func (*Repos) Activity

func (r *Repos) Activity() *ActivityRepo

func (*Repos) ActivityAsset

func (r *Repos) ActivityAsset() *ActivityAssetRepo

func (*Repos) Appled

func (r *Repos) Appled() *AppledRepo

func (*Repos) Asset

func (r *Repos) Asset() *AssetRepo

func (*Repos) CloseAll

func (r *Repos) CloseAll()

func (*Repos) Comment

func (r *Repos) Comment() *CommentRepo

func (*Repos) CommentDraftBackup

func (r *Repos) CommentDraftBackup() *CommentDraftBackupRepo

func (*Repos) Course

func (r *Repos) Course() *CourseRepo

func (*Repos) CourseLesson

func (r *Repos) CourseLesson() *CourseLessonRepo

func (*Repos) EVT

func (r *Repos) EVT() *EVTRepo

func (*Repos) Email

func (r *Repos) Email() *EmailRepo

func (*Repos) Enrolled

func (r *Repos) Enrolled() *EnrolledRepo

func (*Repos) Event

func (r *Repos) Event() *EventRepo

func (*Repos) GetAppleable

func (r *Repos) GetAppleable(
	ctx context.Context,
	appleableID *mytype.OID,
) (NodePermit, error)

func (*Repos) GetCommentable

func (r *Repos) GetCommentable(
	ctx context.Context,
	nodeID *mytype.OID,
) (NodePermit, error)

func (*Repos) GetCreateable

func (r *Repos) GetCreateable(
	ctx context.Context,
	nodeID *mytype.OID,
) (NodePermit, error)

func (*Repos) GetEnrollable

func (r *Repos) GetEnrollable(
	ctx context.Context,
	enrollableID *mytype.OID,
) (NodePermit, error)

func (*Repos) GetLabelable

func (r *Repos) GetLabelable(
	ctx context.Context,
	labelableID *mytype.OID,
) (NodePermit, error)

func (*Repos) GetNode

func (r *Repos) GetNode(
	ctx context.Context,
	nodeID *mytype.OID,
) (NodePermit, error)

func (*Repos) GetNotificationSubject

func (r *Repos) GetNotificationSubject(
	ctx context.Context,
	nodeID *mytype.OID,
) (NodePermit, error)

func (*Repos) GetPublishable

func (r *Repos) GetPublishable(
	ctx context.Context,
	nodeID *mytype.OID,
) (NodePermit, error)

func (*Repos) GetReferenceable

func (r *Repos) GetReferenceable(
	ctx context.Context,
	nodeID *mytype.OID,
) (NodePermit, error)

func (*Repos) GetRenameable

func (r *Repos) GetRenameable(
	ctx context.Context,
	nodeID *mytype.OID,
) (NodePermit, error)

func (*Repos) GetTopicable

func (r *Repos) GetTopicable(
	ctx context.Context,
	topicableID *mytype.OID,
) (NodePermit, error)

func (*Repos) Label

func (r *Repos) Label() *LabelRepo

func (*Repos) Labeled

func (r *Repos) Labeled() *LabeledRepo

func (*Repos) Lesson

func (r *Repos) Lesson() *LessonRepo

func (*Repos) LessonDraftBackup

func (r *Repos) LessonDraftBackup() *LessonDraftBackupRepo

func (*Repos) Notification

func (r *Repos) Notification() *NotificationRepo

func (*Repos) OpenAll

func (r *Repos) OpenAll(p *Permitter) error

func (*Repos) PRT

func (r *Repos) PRT() *PRTRepo

func (*Repos) ParseLessonBodyForEvents

func (r *Repos) ParseLessonBodyForEvents(
	ctx context.Context,
	body *mytype.Markdown,
	lessonID,
	studyID,
	userID *mytype.OID,
) error

func (*Repos) ParseUserAssetBodyForEvents

func (r *Repos) ParseUserAssetBodyForEvents(
	ctx context.Context,
	body *mytype.Markdown,
	assetID,
	studyID,
	userID *mytype.OID,
) error

func (*Repos) ReplaceMarkdownLinksWithRefs

func (r *Repos) ReplaceMarkdownLinksWithRefs(
	ctx context.Context,
	markdown,
	studyID string,
) (string, error, bool)
func (r *Repos) ReplaceMarkdownRefsWithLinks(
	ctx context.Context,
	markdown mytype.Markdown,
	studyID string,
) (*mytype.Markdown, error, bool)

func (*Repos) Study

func (r *Repos) Study() *StudyRepo

func (*Repos) Topic

func (r *Repos) Topic() *TopicRepo

func (*Repos) Topiced

func (r *Repos) Topiced() *TopicedRepo

func (*Repos) Use

func (r *Repos) Use(h http.Handler) http.Handler

func (*Repos) User

func (r *Repos) User() *UserRepo

func (*Repos) UserAsset

func (r *Repos) UserAsset() *UserAssetRepo

type StudyNodePermit

type StudyNodePermit interface {
	ID() (*mytype.OID, error)
	StudyID() (*mytype.OID, error)
}

type StudyPermit

type StudyPermit struct {
	// contains filtered or unexported fields
}

func (*StudyPermit) AdvancedAt

func (r *StudyPermit) AdvancedAt() (*time.Time, error)

func (*StudyPermit) AppledAt

func (r *StudyPermit) AppledAt() time.Time

func (*StudyPermit) CreatedAt

func (r *StudyPermit) CreatedAt() (time.Time, error)

func (*StudyPermit) Description

func (r *StudyPermit) Description() (string, error)

func (*StudyPermit) EnrolledAt

func (r *StudyPermit) EnrolledAt() time.Time

func (*StudyPermit) Get

func (r *StudyPermit) Get() *data.Study

func (*StudyPermit) ID

func (r *StudyPermit) ID() (*mytype.OID, error)

func (*StudyPermit) Name

func (r *StudyPermit) Name() (string, error)

func (*StudyPermit) Private

func (r *StudyPermit) Private() (bool, error)

func (*StudyPermit) TopicedAt

func (r *StudyPermit) TopicedAt() time.Time

func (*StudyPermit) UpdatedAt

func (r *StudyPermit) UpdatedAt() (time.Time, error)

func (*StudyPermit) UserID

func (r *StudyPermit) UserID() (*mytype.OID, error)

type StudyRepo

type StudyRepo struct {
	// contains filtered or unexported fields
}

func NewStudyRepo

func NewStudyRepo(conf *myconf.Config) *StudyRepo

func (*StudyRepo) CheckConnection

func (r *StudyRepo) CheckConnection() error

func (*StudyRepo) Close

func (r *StudyRepo) Close()

func (*StudyRepo) CountByApplee

func (r *StudyRepo) CountByApplee(
	ctx context.Context,
	appleeID string,
	filters *data.StudyFilterOptions,
) (int32, error)

func (*StudyRepo) CountByEnrollee

func (r *StudyRepo) CountByEnrollee(
	ctx context.Context,
	enrolleeID string,
	filters *data.StudyFilterOptions,
) (int32, error)

func (*StudyRepo) CountBySearch

func (r *StudyRepo) CountBySearch(
	ctx context.Context,
	filters *data.StudyFilterOptions,
) (int32, error)

func (*StudyRepo) CountByTopic

func (r *StudyRepo) CountByTopic(
	ctx context.Context,
	topicID string,
	filters *data.StudyFilterOptions,
) (int32, error)

func (*StudyRepo) CountByUser

func (r *StudyRepo) CountByUser(
	ctx context.Context,
	userID string,
	filters *data.StudyFilterOptions,
) (int32, error)

func (*StudyRepo) Create

func (r *StudyRepo) Create(
	ctx context.Context,
	s *data.Study,
) (*StudyPermit, error)

func (*StudyRepo) Delete

func (r *StudyRepo) Delete(
	ctx context.Context,
	study *data.Study,
) error

func (*StudyRepo) Get

func (r *StudyRepo) Get(
	ctx context.Context,
	id string,
) (*StudyPermit, error)

func (*StudyRepo) GetByApplee

func (r *StudyRepo) GetByApplee(
	ctx context.Context,
	appleeID string,
	po *data.PageOptions,
	filters *data.StudyFilterOptions,
) ([]*StudyPermit, error)

func (*StudyRepo) GetByEnrollee

func (r *StudyRepo) GetByEnrollee(
	ctx context.Context,
	enrolleeID string,
	po *data.PageOptions,
	filters *data.StudyFilterOptions,
) ([]*StudyPermit, error)

func (*StudyRepo) GetByName

func (r *StudyRepo) GetByName(
	ctx context.Context,
	userID,
	name string,
) (*StudyPermit, error)

func (*StudyRepo) GetByTopic

func (r *StudyRepo) GetByTopic(
	ctx context.Context,
	topicID string,
	po *data.PageOptions,
	filters *data.StudyFilterOptions,
) ([]*StudyPermit, error)

func (*StudyRepo) GetByUser

func (r *StudyRepo) GetByUser(
	ctx context.Context,
	userID string,
	po *data.PageOptions,
	filters *data.StudyFilterOptions,
) ([]*StudyPermit, error)

func (*StudyRepo) GetByUserAndName

func (r *StudyRepo) GetByUserAndName(
	ctx context.Context,
	owner,
	name string,
) (*StudyPermit, error)

func (*StudyRepo) Open

func (r *StudyRepo) Open(p *Permitter) error

func (*StudyRepo) Search

func (r *StudyRepo) Search(
	ctx context.Context,
	po *data.PageOptions,
	filters *data.StudyFilterOptions,
) ([]*StudyPermit, error)

func (*StudyRepo) Update

func (r *StudyRepo) Update(
	ctx context.Context,
	s *data.Study,
) (*StudyPermit, error)

func (*StudyRepo) ViewerCanAdmin

func (r *StudyRepo) ViewerCanAdmin(
	ctx context.Context,
	s *data.Study,
) (bool, error)

type TopicPermit

type TopicPermit struct {
	// contains filtered or unexported fields
}

func (*TopicPermit) CreatedAt

func (r *TopicPermit) CreatedAt() (time.Time, error)

func (*TopicPermit) Description

func (r *TopicPermit) Description() (string, error)

func (*TopicPermit) Get

func (r *TopicPermit) Get() *data.Topic

func (*TopicPermit) ID

func (r *TopicPermit) ID() (*mytype.OID, error)

func (*TopicPermit) Name

func (r *TopicPermit) Name() (string, error)

func (*TopicPermit) UpdatedAt

func (r *TopicPermit) UpdatedAt() (time.Time, error)

type TopicRepo

type TopicRepo struct {
	// contains filtered or unexported fields
}

func NewTopicRepo

func NewTopicRepo(conf *myconf.Config) *TopicRepo

func (*TopicRepo) CheckConnection

func (r *TopicRepo) CheckConnection() error

func (*TopicRepo) Close

func (r *TopicRepo) Close()

func (*TopicRepo) CountBySearch

func (r *TopicRepo) CountBySearch(
	ctx context.Context,
	filters *data.TopicFilterOptions,
) (int32, error)

func (*TopicRepo) CountByTopicable

func (r *TopicRepo) CountByTopicable(
	ctx context.Context,
	topicableID string,
	filters *data.TopicFilterOptions,
) (int32, error)

func (*TopicRepo) Create

func (r *TopicRepo) Create(
	ctx context.Context,
	s *data.Topic,
) (*TopicPermit, error)

func (*TopicRepo) Get

func (r *TopicRepo) Get(
	ctx context.Context,
	id string,
) (*TopicPermit, error)

func (*TopicRepo) GetByName

func (r *TopicRepo) GetByName(
	ctx context.Context,
	name string,
) (*TopicPermit, error)

func (*TopicRepo) GetByTopicable

func (r *TopicRepo) GetByTopicable(
	ctx context.Context,
	topicableID string,
	po *data.PageOptions,
	filters *data.TopicFilterOptions,
) ([]*TopicPermit, error)

func (*TopicRepo) Open

func (r *TopicRepo) Open(p *Permitter) error

func (*TopicRepo) Search

func (r *TopicRepo) Search(
	ctx context.Context,
	po *data.PageOptions,
	filters *data.TopicFilterOptions,
) ([]*TopicPermit, error)

func (*TopicRepo) Update

func (r *TopicRepo) Update(
	ctx context.Context,
	s *data.Topic,
) (*TopicPermit, error)

type TopicablePermit

type TopicablePermit interface {
	ID() (*mytype.OID, error)
	TopicedAt() time.Time
}

type TopicedPermit

type TopicedPermit struct {
	// contains filtered or unexported fields
}

func (*TopicedPermit) CreatedAt

func (r *TopicedPermit) CreatedAt() (time.Time, error)

func (*TopicedPermit) Get

func (r *TopicedPermit) Get() *data.Topiced

func (*TopicedPermit) ID

func (r *TopicedPermit) ID() (int32, error)

func (*TopicedPermit) TopicID

func (r *TopicedPermit) TopicID() (*mytype.OID, error)

func (*TopicedPermit) TopicableID

func (r *TopicedPermit) TopicableID() (*mytype.OID, error)

type TopicedRepo

type TopicedRepo struct {
	// contains filtered or unexported fields
}

func NewTopicedRepo

func NewTopicedRepo(conf *myconf.Config) *TopicedRepo

func (*TopicedRepo) CheckConnection

func (r *TopicedRepo) CheckConnection() error

func (*TopicedRepo) Close

func (r *TopicedRepo) Close()

func (*TopicedRepo) Connect

func (r *TopicedRepo) Connect(
	ctx context.Context,
	topiced *data.Topiced,
) (*TopicedPermit, error)

func (*TopicedRepo) CountByTopic

func (r *TopicedRepo) CountByTopic(
	ctx context.Context,
	topicID string,
) (int32, error)

func (*TopicedRepo) CountByTopicable

func (r *TopicedRepo) CountByTopicable(
	ctx context.Context,
	topicableID string,
) (int32, error)

func (*TopicedRepo) Disconnect

func (r *TopicedRepo) Disconnect(
	ctx context.Context,
	topiced *data.Topiced,
) error

func (*TopicedRepo) Get

func (r *TopicedRepo) Get(
	ctx context.Context,
	t *data.Topiced,
) (*TopicedPermit, error)

func (*TopicedRepo) GetByTopic

func (r *TopicedRepo) GetByTopic(
	ctx context.Context,
	topicID string,
	po *data.PageOptions,
) ([]*TopicedPermit, error)

func (*TopicedRepo) GetByTopicable

func (r *TopicedRepo) GetByTopicable(
	ctx context.Context,
	topicableID string,
	po *data.PageOptions,
) ([]*TopicedPermit, error)

func (*TopicedRepo) Open

func (r *TopicedRepo) Open(p *Permitter) error

type UserAssetPermit

type UserAssetPermit struct {
	// contains filtered or unexported fields
}

func (*UserAssetPermit) ActivityID

func (r *UserAssetPermit) ActivityID() (*mytype.OID, error)

func (*UserAssetPermit) ActivityNumber

func (r *UserAssetPermit) ActivityNumber() (*int32, error)

func (*UserAssetPermit) CreatedAt

func (r *UserAssetPermit) CreatedAt() (time.Time, error)

func (*UserAssetPermit) Description

func (r *UserAssetPermit) Description() (string, error)

func (*UserAssetPermit) Get

func (r *UserAssetPermit) Get() *data.UserAsset

func (*UserAssetPermit) ID

func (r *UserAssetPermit) ID() (*mytype.OID, error)

func (*UserAssetPermit) Key

func (r *UserAssetPermit) Key() (string, error)

func (*UserAssetPermit) Name

func (r *UserAssetPermit) Name() (string, error)

func (*UserAssetPermit) OriginalName

func (r *UserAssetPermit) OriginalName() (string, error)

func (*UserAssetPermit) Size

func (r *UserAssetPermit) Size() (int64, error)

func (*UserAssetPermit) StudyID

func (r *UserAssetPermit) StudyID() (*mytype.OID, error)

func (*UserAssetPermit) Subtype

func (r *UserAssetPermit) Subtype() (string, error)

func (*UserAssetPermit) Type

func (r *UserAssetPermit) Type() (string, error)

func (*UserAssetPermit) UpdatedAt

func (r *UserAssetPermit) UpdatedAt() (time.Time, error)

func (*UserAssetPermit) UserID

func (r *UserAssetPermit) UserID() (*mytype.OID, error)

type UserAssetRepo

type UserAssetRepo struct {
	// contains filtered or unexported fields
}

func NewUserAssetRepo

func NewUserAssetRepo(conf *myconf.Config) *UserAssetRepo

func (*UserAssetRepo) BatchGetByName

func (r *UserAssetRepo) BatchGetByName(
	ctx context.Context,
	studyID string,
	names []string,
) ([]*UserAssetPermit, error)

func (*UserAssetRepo) CheckConnection

func (r *UserAssetRepo) CheckConnection() error

func (*UserAssetRepo) Close

func (r *UserAssetRepo) Close()

func (*UserAssetRepo) CountByActivity

func (r *UserAssetRepo) CountByActivity(
	ctx context.Context,
	activityID string,
	filters *data.UserAssetFilterOptions,
) (int32, error)

func (*UserAssetRepo) CountByLabel

func (r *UserAssetRepo) CountByLabel(
	ctx context.Context,
	labelID string,
	filters *data.UserAssetFilterOptions,
) (int32, error)

func (*UserAssetRepo) CountBySearch

func (r *UserAssetRepo) CountBySearch(
	ctx context.Context,
	filters *data.UserAssetFilterOptions,
) (int32, error)

func (*UserAssetRepo) CountByStudy

func (r *UserAssetRepo) CountByStudy(
	ctx context.Context,
	studyID string,
	filters *data.UserAssetFilterOptions,
) (int32, error)

func (*UserAssetRepo) CountByUser

func (r *UserAssetRepo) CountByUser(
	ctx context.Context,
	userID string,
	filters *data.UserAssetFilterOptions,
) (int32, error)

func (*UserAssetRepo) Create

func (r *UserAssetRepo) Create(
	ctx context.Context,
	a *data.UserAsset,
) (*UserAssetPermit, error)

func (*UserAssetRepo) Delete

func (r *UserAssetRepo) Delete(
	ctx context.Context,
	userAsset *data.UserAsset,
) error

func (*UserAssetRepo) Get

func (r *UserAssetRepo) Get(
	ctx context.Context,
	id string,
) (*UserAssetPermit, error)

func (*UserAssetRepo) GetByActivity

func (r *UserAssetRepo) GetByActivity(
	ctx context.Context,
	activityID string,
	po *data.PageOptions,
	filters *data.UserAssetFilterOptions,
) ([]*UserAssetPermit, error)

func (*UserAssetRepo) GetByActivityNumber

func (r *UserAssetRepo) GetByActivityNumber(
	ctx context.Context,
	activityID string,
	activityNumber int32,
) (*UserAssetPermit, error)

func (*UserAssetRepo) GetByLabel

func (r *UserAssetRepo) GetByLabel(
	ctx context.Context,
	labelID string,
	po *data.PageOptions,
	filters *data.UserAssetFilterOptions,
) ([]*UserAssetPermit, error)

func (*UserAssetRepo) GetByName

func (r *UserAssetRepo) GetByName(
	ctx context.Context,
	studyID,
	name string,
) (*UserAssetPermit, error)

func (*UserAssetRepo) GetByStudy

func (r *UserAssetRepo) GetByStudy(
	ctx context.Context,
	studyID string,
	po *data.PageOptions,
	filters *data.UserAssetFilterOptions,
) ([]*UserAssetPermit, error)

func (*UserAssetRepo) GetByUser

func (r *UserAssetRepo) GetByUser(
	ctx context.Context,
	userID string,
	po *data.PageOptions,
	filters *data.UserAssetFilterOptions,
) ([]*UserAssetPermit, error)

func (*UserAssetRepo) GetByUserStudyAndName

func (r *UserAssetRepo) GetByUserStudyAndName(
	ctx context.Context,
	userLogin,
	studyName,
	name string,
) (*UserAssetPermit, error)

func (*UserAssetRepo) Open

func (r *UserAssetRepo) Open(p *Permitter) error

func (*UserAssetRepo) Search

func (*UserAssetRepo) Update

func (r *UserAssetRepo) Update(
	ctx context.Context,
	a *data.UserAsset,
) (*UserAssetPermit, error)

func (*UserAssetRepo) ViewerCanDelete

func (r *UserAssetRepo) ViewerCanDelete(
	ctx context.Context,
	l *data.UserAsset,
) bool

func (*UserAssetRepo) ViewerCanUpdate

func (r *UserAssetRepo) ViewerCanUpdate(
	ctx context.Context,
	l *data.UserAsset,
) bool

type UserPermit

type UserPermit struct {
	// contains filtered or unexported fields
}

func (*UserPermit) AccountUpdatedAt

func (r *UserPermit) AccountUpdatedAt() (time.Time, error)

func (*UserPermit) AppledAt

func (r *UserPermit) AppledAt() time.Time

func (*UserPermit) Bio

func (r *UserPermit) Bio() (string, error)

func (*UserPermit) CreatedAt

func (r *UserPermit) CreatedAt() (time.Time, error)

func (*UserPermit) EnrolledAt

func (r *UserPermit) EnrolledAt() time.Time

func (*UserPermit) Get

func (r *UserPermit) Get() *data.User

func (*UserPermit) ID

func (r *UserPermit) ID() (*mytype.OID, error)

func (*UserPermit) Login

func (r *UserPermit) Login() (string, error)

func (*UserPermit) Name

func (r *UserPermit) Name() (string, error)

func (*UserPermit) ProfileEmailID

func (r *UserPermit) ProfileEmailID() (*mytype.OID, error)

func (*UserPermit) ProfileUpdatedAt

func (r *UserPermit) ProfileUpdatedAt() (time.Time, error)

func (*UserPermit) Roles

func (r *UserPermit) Roles() []string

func (*UserPermit) Verified

func (r *UserPermit) Verified() (bool, error)

type UserRepo

type UserRepo struct {
	// contains filtered or unexported fields
}

func NewUserRepo

func NewUserRepo(conf *myconf.Config) *UserRepo

func (*UserRepo) BatchGetByLogin

func (r *UserRepo) BatchGetByLogin(
	ctx context.Context,
	logins []string,
) ([]*UserPermit, error)

func (*UserRepo) CheckConnection

func (r *UserRepo) CheckConnection() error

func (*UserRepo) Close

func (r *UserRepo) Close()

func (*UserRepo) CountByAppleable

func (r *UserRepo) CountByAppleable(
	ctx context.Context,
	studyID string,
	filters *data.UserFilterOptions,
) (int32, error)

func (*UserRepo) CountByEnrollable

func (r *UserRepo) CountByEnrollable(
	ctx context.Context,
	enrollableID string,
	filters *data.UserFilterOptions,
) (int32, error)

func (*UserRepo) CountByEnrollee

func (r *UserRepo) CountByEnrollee(
	ctx context.Context,
	enrolleeID string,
	filters *data.UserFilterOptions,
) (int32, error)

func (*UserRepo) CountBySearch

func (r *UserRepo) CountBySearch(
	ctx context.Context,
	filters *data.UserFilterOptions,
) (int32, error)

func (*UserRepo) Create

func (r *UserRepo) Create(
	ctx context.Context,
	u *data.User,
) (*UserPermit, error)

func (*UserRepo) Delete

func (r *UserRepo) Delete(
	ctx context.Context,
	user *data.User,
) error

func (*UserRepo) Exists

func (r *UserRepo) Exists(
	ctx context.Context,
	id string,
) (bool, error)

func (*UserRepo) ExistsByLogin

func (r *UserRepo) ExistsByLogin(
	ctx context.Context,
	login string,
) (bool, error)

func (*UserRepo) Get

func (r *UserRepo) Get(
	ctx context.Context,
	id string,
) (*UserPermit, error)

func (*UserRepo) GetByAppleable

func (r *UserRepo) GetByAppleable(
	ctx context.Context,
	appleableID string,
	po *data.PageOptions,
	filters *data.UserFilterOptions,
) ([]*UserPermit, error)

func (*UserRepo) GetByEnrollable

func (r *UserRepo) GetByEnrollable(
	ctx context.Context,
	enrollableID string,
	po *data.PageOptions,
	filters *data.UserFilterOptions,
) ([]*UserPermit, error)

func (*UserRepo) GetByEnrollee

func (r *UserRepo) GetByEnrollee(
	ctx context.Context,
	enrolleeID string,
	po *data.PageOptions,
	filters *data.UserFilterOptions,
) ([]*UserPermit, error)

func (*UserRepo) GetByLogin

func (r *UserRepo) GetByLogin(
	ctx context.Context,
	login string,
) (*UserPermit, error)

func (*UserRepo) Open

func (r *UserRepo) Open(p *Permitter) error

func (*UserRepo) Search

func (r *UserRepo) Search(
	ctx context.Context,
	po *data.PageOptions,
	filters *data.UserFilterOptions,
) ([]*UserPermit, error)

func (*UserRepo) UpdateAccount

func (r *UserRepo) UpdateAccount(
	ctx context.Context,
	u *data.User,
) (*UserPermit, error)

func (*UserRepo) UpdateProfile

func (r *UserRepo) UpdateProfile(
	ctx context.Context,
	u *data.User,
) (*UserPermit, error)

Jump to

Keyboard shortcuts

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