Documentation ¶
Index ¶
- func CountNotices() int64
- func CreateNotice(ctx context.Context, tp NoticeType, desc string, args ...any) error
- func CreateRepositoryNotice(desc string, args ...any) error
- func DeleteNotice(ctx context.Context, id int64) error
- func DeleteNotices(ctx context.Context, start, end int64) error
- func DeleteNoticesByIDs(ctx context.Context, ids []int64) error
- func DeleteOldSystemNotices(ctx context.Context, olderThan time.Duration) (err error)
- func GetAllSettings(ctx context.Context) (revision int, res map[string]string, err error)
- func GetAppStateContent(key string) (content string, err error)
- func GetRevision(ctx context.Context) int
- func NewDatabaseDynKeyGetter() config.DynKeyGetter
- func RemoveAllWithNotice(ctx context.Context, title, path string)
- func RemoveStorageWithNotice(ctx context.Context, bucket storage.ObjectStorage, title, path string)
- func SaveAppStateContent(key, content string) error
- func SetSettings(ctx context.Context, settings map[string]string) error
- type AppState
- type Notice
- type NoticeType
- type Setting
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateNotice ¶
CreateNotice creates new system notice.
func CreateRepositoryNotice ¶
CreateRepositoryNotice creates new system notice with type NoticeRepository.
func DeleteNotice ¶
DeleteNotice deletes a system notice by given ID.
func DeleteNotices ¶
DeleteNotices deletes all notices with ID from start to end (inclusive).
func DeleteNoticesByIDs ¶
DeleteNoticesByIDs deletes notices by given IDs.
func DeleteOldSystemNotices ¶
DeleteOldSystemNotices deletes all old system notices from database.
func GetAllSettings ¶
func GetAppStateContent ¶
GetAppStateContent gets an app state from database
func GetRevision ¶
func NewDatabaseDynKeyGetter ¶
func NewDatabaseDynKeyGetter() config.DynKeyGetter
func RemoveAllWithNotice ¶
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.
func SaveAppStateContent ¶
SaveAppStateContent saves the app state item to database
Types ¶
type AppState ¶
type AppState struct { ID string `xorm:"pk varchar(200)"` Revision int64 Content string `xorm:"LONGTEXT"` }
AppState represents a state record in database if one day we would make Gitea run as a cluster, we can introduce a new field `Scope` here to store different states for different nodes
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.
type NoticeType ¶
type NoticeType int
NoticeType describes the notice type
const ( // NoticeRepository type NoticeRepository NoticeType = iota + 1 // NoticeTask type NoticeTask )