admin

package
v1.16.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: MIT Imports: 7 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountNotices

func CountNotices() int64

CountNotices returns number of notices.

func CreateNotice

func CreateNotice(ctx context.Context, tp NoticeType, desc string, args ...interface{}) error

CreateNotice creates new system notice.

func CreateRepositoryNotice

func CreateRepositoryNotice(desc string, args ...interface{}) error

CreateRepositoryNotice creates new system notice with type NoticeRepository.

func DeleteNotice

func DeleteNotice(id int64) error

DeleteNotice deletes a system notice by given ID.

func DeleteNotices

func DeleteNotices(start, end int64) error

DeleteNotices deletes all notices with ID from start to end (inclusive).

func DeleteNoticesByIDs

func DeleteNoticesByIDs(ids []int64) error

DeleteNoticesByIDs deletes notices by given IDs.

func RemoveAllWithNotice

func RemoveAllWithNotice(ctx context.Context, title, path string)

RemoveAllWithNotice removes all directories in given path and creates a system notice when error occurs.

func RemoveStorageWithNotice

func RemoveStorageWithNotice(ctx context.Context, bucket storage.ObjectStorage, title, path string)

RemoveStorageWithNotice removes a file from the storage and creates a system notice when error occurs.

Types

type Notice

type Notice struct {
	ID          int64 `xorm:"pk autoincr"`
	Type        NoticeType
	Description string             `xorm:"TEXT"`
	CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
}

Notice represents a system notice for admin.

func Notices

func Notices(page, pageSize int) ([]*Notice, error)

Notices returns notices in given page.

func (*Notice) TrStr

func (n *Notice) TrStr() string

TrStr returns a translation format string.

type NoticeType

type NoticeType int

NoticeType describes the notice type

const (
	// NoticeRepository type
	NoticeRepository NoticeType = iota + 1
	// NoticeTask type
	NoticeTask
)

Jump to

Keyboard shortcuts

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