Documentation
¶
Index ¶
- func AccessorTypes() []string
- func Arrange[T any, K comparable](elems []T, el T, idx int, key func(a T) K, override bool) []T
- func CompareProperty(t string, a, b string) int
- func ContextWithUserName(ctx context.Context, email string) context.Context
- func PropertyTypes() []string
- func UserNameFromContext(ctx context.Context) string
- type APIResponse
- type Access
- type AccessFinder
- type AccessUpdater
- type Accessor
- type Config
- type Default
- type DefaultFinder
- type DefaultUpdater
- type Entry
- type EntryFinder
- type EntrySearcher
- type EntryTypeConfig
- type EntryTypeInfo
- type EntryTypeUpdater
- type ForgeConfig
- type Global
- type GlobalFinder
- type GlobalUpdater
- type Group
- type GroupFinder
- type GroupUpdater
- type KeyTypeValue
- type KeyValue
- type Log
- type LogFinder
- type Member
- type MemberFinder
- type NotFoundError
- type OIDC
- type Property
- type PropertyFinder
- type PropertyUpdater
- type QuickSearchArranger
- type Server
- func (s *Server) ActiveUsers(ctx context.Context) ([]*User, error)
- func (s *Server) AddAccess(ctx context.Context, path string, accessor, mode string) error
- func (s *Server) AddDefault(ctx context.Context, entType, ctg, name, typ, value string) error
- func (s *Server) AddEntry(ctx context.Context, path, typ string) error
- func (s *Server) AddEntryType(ctx context.Context, name string) error
- func (s *Server) AddEnviron(ctx context.Context, path string, name, typ, value string) error
- func (s *Server) AddGlobal(ctx context.Context, entType, name, typ, value string) error
- func (s *Server) AddGroup(ctx context.Context, g *Group) error
- func (s *Server) AddGroupMember(ctx context.Context, group, member string) error
- func (s *Server) AddThumbnail(ctx context.Context, path string, img image.Image) error
- func (s *Server) AddUser(ctx context.Context, u *User) error
- func (s *Server) AddUserDataSection(ctx context.Context, user, section string) error
- func (s *Server) AllGroups(ctx context.Context) ([]*Group, error)
- func (s *Server) AllUsers(ctx context.Context) ([]*User, error)
- func (s *Server) ArchiveEntry(ctx context.Context, path string) error
- func (s *Server) CountAllSubEntries(ctx context.Context, path string) (int, error)
- func (s *Server) Defaults(ctx context.Context, entType string) ([]*Default, error)
- func (s *Server) DeleteAccess(ctx context.Context, path string, accessor string) error
- func (s *Server) DeleteDefault(ctx context.Context, entType, ctg, name string) error
- func (s *Server) DeleteEntry(ctx context.Context, path string) error
- func (s *Server) DeleteEntryRecursive(ctx context.Context, path string) error
- func (s *Server) DeleteEntryType(ctx context.Context, name string) error
- func (s *Server) DeleteEnviron(ctx context.Context, path string, name string) error
- func (s *Server) DeleteGlobal(ctx context.Context, entType, name string) error
- func (s *Server) DeleteGroupMember(ctx context.Context, group, member string) error
- func (s *Server) DeleteThumbnail(ctx context.Context, path string) error
- func (s *Server) DeleteUserData(ctx context.Context, user, section, key string) error
- func (s *Server) DeleteUserDataSection(ctx context.Context, user, section string) error
- func (s *Server) DisabledUsers(ctx context.Context) ([]*User, error)
- func (s *Server) EntryAccessList(ctx context.Context, path string) ([]*Access, error)
- func (s *Server) EntryEnvirons(ctx context.Context, path string) ([]*Property, error)
- func (s *Server) EntryLogs(ctx context.Context, path string) ([]*Log, error)
- func (s *Server) EntryProperties(ctx context.Context, path string) ([]*Property, error)
- func (s *Server) FindBaseEntryTypes(ctx context.Context) ([]string, error)
- func (s *Server) FindEntries(ctx context.Context, find EntryFinder) ([]*Entry, error)
- func (s *Server) FindEntryTypes(ctx context.Context) ([]string, error)
- func (s *Server) FindOverrideEntryTypes(ctx context.Context) ([]string, error)
- func (s *Server) FindUserData(ctx context.Context, find UserDataFinder) ([]*UserDataSection, error)
- func (s *Server) GetAccess(ctx context.Context, path string, accessor string) (*Access, error)
- func (s *Server) GetAccessList(ctx context.Context, path string) ([]*Access, error)
- func (s *Server) GetEntry(ctx context.Context, path string) (*Entry, error)
- func (s *Server) GetEnviron(ctx context.Context, path, name string) (*Property, error)
- func (s *Server) GetEnvirons(ctx context.Context, path string) ([]*Property, error)
- func (s *Server) GetGlobal(ctx context.Context, entType, name string) (*Global, error)
- func (s *Server) GetGroup(ctx context.Context, group string) (*Group, error)
- func (s *Server) GetLogs(ctx context.Context, path, ctg, name string) ([]*Log, error)
- func (s *Server) GetProperty(ctx context.Context, path string, name string) (*Property, error)
- func (s *Server) GetThumbnail(ctx context.Context, path string) (*Thumbnail, error)
- func (s *Server) GetUser(ctx context.Context, user string) (*User, error)
- func (s *Server) GetUserData(ctx context.Context, user, section, key string) (string, error)
- func (s *Server) GetUserDataSection(ctx context.Context, user, section string) (*UserDataSection, error)
- func (s *Server) GetUserSetting(ctx context.Context, user string) (*UserSetting, error)
- func (s *Server) Globals(ctx context.Context, entType string) ([]*Global, error)
- func (s *Server) GroupMembers(ctx context.Context, group string) ([]*Member, error)
- func (s *Server) IsAdmin(ctx context.Context, user string) (bool, error)
- func (s *Server) ParentEntries(ctx context.Context, path string) ([]*Entry, error)
- func (s *Server) RenameEntry(ctx context.Context, path, newName string) error
- func (s *Server) RenameEntryType(ctx context.Context, name, newName string) error
- func (s *Server) RenameGroup(ctx context.Context, name string, newName string) error
- func (s *Server) SearchEntries(ctx context.Context, path, query string) ([]*Entry, error)
- func (s *Server) SetUserData(ctx context.Context, user, section, key, value string) error
- func (s *Server) SubEntries(ctx context.Context, path string) ([]*Entry, error)
- func (s *Server) UnarchiveEntry(ctx context.Context, path string) error
- func (s *Server) UpdateAccess(ctx context.Context, path, accessor, mode string) error
- func (s *Server) UpdateDefault(ctx context.Context, entType, ctg, name string, newName, typ, value *string) error
- func (s *Server) UpdateEnviron(ctx context.Context, path string, name, value string) error
- func (s *Server) UpdateGlobal(ctx context.Context, entType, name, typ, value string) error
- func (s *Server) UpdateProperties(ctx context.Context, upds []PropertyUpdater) error
- func (s *Server) UpdateProperty(ctx context.Context, path string, name, value string) error
- func (s *Server) UpdateThumbnail(ctx context.Context, path string, img image.Image) error
- func (s *Server) UpdateUserCalled(ctx context.Context, user, called string) error
- func (s *Server) UpdateUserDisabled(ctx context.Context, user string, disabled bool) error
- func (s *Server) UpdateUserSetting(ctx context.Context, user, key string, value any) error
- func (s *Server) UserRead(ctx context.Context, path string) error
- func (s *Server) UserWrite(ctx context.Context, path string) error
- type Service
- type Status
- type StringKV
- type StringSliceArranger
- type Thumbnail
- type ThumbnailFinder
- type ThumbnailUpdater
- type UnauthorizedError
- type User
- type UserDataFinder
- type UserDataSection
- type UserFinder
- type UserSetting
- type UserSettingFinder
- type UserSettingUpdater
- type UserUpdater
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccessorTypes ¶
func AccessorTypes() []string
func Arrange ¶
func Arrange[T any, K comparable](elems []T, el T, idx int, key func(a T) K, override bool) []T
Arrange inserts/removes a element 'el' at index 'idx'.
It will perform equality check with 'key(el)'. When key function is nil, it cannot compare elements. So 'elems' will be returned as untouched.
If a key for 'el' already exists, it will override the value if user set 'override' to true. When it overrides, it will not touch the original index.
idx < 0 means remove the element. idx >= len(elems) means append it to the last.
ex) When elems is []string{"a", "b", "c"} with given arguments, results will be same as following.
elems = []string{"b", "c"} where path = "a" and idx = -1
elems = []string{"a", "b", "c"} where path = "a" and idx = 0
elems = []string{"b", "a", "c"} where path = "a" and idx = 1
elems = []string{"b", "c", "a"} where path = "a" and idx = 2
func CompareProperty ¶
func ContextWithUserName ¶
func PropertyTypes ¶
func PropertyTypes() []string
func UserNameFromContext ¶
Types ¶
type APIResponse ¶
type Access ¶
type Access struct {
ID int
EntryPath string
Name string
Type string // Don't need when adding Access.
Value string
Eval string
RawValue int
UpdatedAt time.Time
}
func (*Access) MarshalJSON ¶
type AccessFinder ¶
type AccessUpdater ¶
type Accessor ¶
Accessor is either a user or a group, that can be specified in entry access control list.
type Config ¶
type Config struct {
Forge *ForgeConfig
EntryType *EntryTypeConfig
}
func LoadConfig ¶
type Default ¶
type Default struct {
ID int
EntryType string
Category string
Name string
Type string
Value string
}
Default is property, environ or sub-entry defined for entry type, So it will be automatically created while creation of an entry of the entry type.
type DefaultFinder ¶
type DefaultUpdater ¶
type Entry ¶
type Entry struct {
ID int
Path string
Type string
Archived bool
CreatedAt time.Time
UpdatedAt time.Time
HasThumbnail bool
Property map[string]*Property
}
func (*Entry) MarshalJSON ¶
type EntryFinder ¶
type EntrySearcher ¶
type EntryTypeConfig ¶
type EntryTypeConfig struct {
Types []EntryTypeInfo
}
type EntryTypeInfo ¶
type EntryTypeInfo struct {
Name string
SubEntries []KeyTypeValue `toml:"sub_entries"`
Properties []KeyTypeValue
Environs []KeyTypeValue
}
type EntryTypeUpdater ¶
type ForgeConfig ¶
type ForgeConfig struct {
UserdataRoot string `toml:"userdata_root"`
}
type Global ¶
Global is similar with Default in a sense that it is tied to an EntryType. But it won't be created for each entry. So it cannot be overrided as well.
type GlobalFinder ¶
type GlobalUpdater ¶
type GroupFinder ¶
type GroupUpdater ¶
type KeyTypeValue ¶
func (*KeyTypeValue) UnmarshalText ¶
func (ktv *KeyTypeValue) UnmarshalText(text []byte) error
type Log ¶
type MemberFinder ¶
type NotFoundError ¶
type NotFoundError struct {
// contains filtered or unexported fields
}
func NotFound ¶
func NotFound(s string, is ...any) *NotFoundError
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
type Property ¶
type Property struct {
ID int
EntryPath string
Name string
Type string
Eval string
Value string
ValueError error
RawValue string
UpdatedAt time.Time
}
Property can be either a normal property or an environment.
func (*Property) MarshalJSON ¶
type PropertyFinder ¶
type PropertyUpdater ¶
type QuickSearchArranger ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) AddDefault ¶
func (*Server) AddEnviron ¶
func (*Server) AddGroupMember ¶
func (*Server) AddThumbnail ¶
AddThumbnail adds a thumbnail image to a entry.
func (*Server) AddUserDataSection ¶
func (*Server) CountAllSubEntries ¶
func (*Server) DeleteAccess ¶
func (*Server) DeleteDefault ¶
func (*Server) DeleteEntryRecursive ¶
func (*Server) DeleteEntryType ¶
func (*Server) DeleteEnviron ¶
func (*Server) DeleteGlobal ¶
func (*Server) DeleteGroupMember ¶
func (*Server) DeleteThumbnail ¶
func (*Server) DeleteUserData ¶
func (*Server) DeleteUserDataSection ¶
func (*Server) EntryAccessList ¶
func (*Server) EntryEnvirons ¶
func (*Server) EntryProperties ¶
func (*Server) FindBaseEntryTypes ¶
func (*Server) FindEntries ¶
func (*Server) FindEntryTypes ¶
func (*Server) FindOverrideEntryTypes ¶
func (*Server) FindUserData ¶
func (s *Server) FindUserData(ctx context.Context, find UserDataFinder) ([]*UserDataSection, error)
func (*Server) GetAccessList ¶
func (*Server) GetEnviron ¶
func (*Server) GetEnvirons ¶
func (*Server) GetProperty ¶
func (*Server) GetThumbnail ¶
GetThumbnail gets a thumbnail image of a entry.
func (*Server) GetUserData ¶
func (*Server) GetUserDataSection ¶
func (*Server) GetUserSetting ¶
func (*Server) GroupMembers ¶
func (*Server) ParentEntries ¶
ParentEntries returns parent entries from root to a given entry (but without the entry).
func (*Server) RenameEntry ¶
func (*Server) RenameEntryType ¶
func (*Server) RenameGroup ¶
func (*Server) SearchEntries ¶
func (*Server) SetUserData ¶
func (*Server) SubEntries ¶
func (*Server) UnarchiveEntry ¶
func (*Server) UpdateAccess ¶
func (*Server) UpdateDefault ¶
func (*Server) UpdateEnviron ¶
func (*Server) UpdateGlobal ¶
func (*Server) UpdateProperties ¶
func (s *Server) UpdateProperties(ctx context.Context, upds []PropertyUpdater) error
func (*Server) UpdateProperty ¶
func (*Server) UpdateThumbnail ¶
func (*Server) UpdateUserCalled ¶
func (*Server) UpdateUserDisabled ¶
func (*Server) UpdateUserSetting ¶
type Service ¶
type Service interface {
FindEntryTypes(ctx context.Context) ([]string, error)
FindBaseEntryTypes(ctx context.Context) ([]string, error)
FindOverrideEntryTypes(ctx context.Context) ([]string, error)
AddEntryType(ctx context.Context, name string) error
RenameEntryType(ctx context.Context, name, newName string) error
DeleteEntryType(ctx context.Context, name string) error
FindDefaults(ctx context.Context, find DefaultFinder) ([]*Default, error)
AddDefault(ctx context.Context, d *Default) error
UpdateDefault(ctx context.Context, upd DefaultUpdater) error
DeleteDefault(ctx context.Context, entType, ctg, name string) error
FindGlobals(ctx context.Context, find GlobalFinder) ([]*Global, error)
GetGlobal(ctx context.Context, entType, name string) (*Global, error)
AddGlobal(ctx context.Context, d *Global) error
UpdateGlobal(ctx context.Context, upd GlobalUpdater) error
DeleteGlobal(ctx context.Context, entType, name string) error
FindEntries(ctx context.Context, find EntryFinder) ([]*Entry, error)
SearchEntries(ctx context.Context, search EntrySearcher) ([]*Entry, error)
CountAllSubEntries(ctx context.Context, path string) (int, error)
GetEntry(ctx context.Context, path string) (*Entry, error)
AddEntry(ctx context.Context, ent *Entry) error
RenameEntry(ctx context.Context, path string, newName string) error
ArchiveEntry(ctx context.Context, path string) error
UnarchiveEntry(ctx context.Context, path string) error
DeleteEntry(ctx context.Context, path string) error
DeleteEntryRecursive(ctx context.Context, path string) error
AddThumbnail(ctx context.Context, thumb *Thumbnail) error
UpdateThumbnail(ctx context.Context, upd ThumbnailUpdater) error
GetThumbnail(ctx context.Context, path string) (*Thumbnail, error)
DeleteThumbnail(ctx context.Context, path string) error
EntryProperties(ctx context.Context, path string) ([]*Property, error)
GetProperty(ctx context.Context, path, name string) (*Property, error)
UpdateProperty(ctx context.Context, upd PropertyUpdater) error
UpdateProperties(ctx context.Context, upds []PropertyUpdater) error
EntryEnvirons(ctx context.Context, path string) ([]*Property, error)
GetEnvirons(ctx context.Context, path string) ([]*Property, error)
GetEnviron(ctx context.Context, path, name string) (*Property, error)
AddEnviron(ctx context.Context, p *Property) error
UpdateEnviron(ctx context.Context, upd PropertyUpdater) error
DeleteEnviron(ctx context.Context, path string, name string) error
EntryAccessList(ctx context.Context, path string) ([]*Access, error)
GetAccessList(ctx context.Context, path string) ([]*Access, error)
GetAccess(ctx context.Context, path, name string) (*Access, error)
AddAccess(ctx context.Context, ac *Access) error
UpdateAccess(ctx context.Context, upd AccessUpdater) error
DeleteAccess(ctx context.Context, path string, name string) error
IsAdmin(ctx context.Context, user string) (bool, error)
FindLogs(ctx context.Context, find LogFinder) ([]*Log, error)
GetLogs(ctx context.Context, path, ctg, name string) ([]*Log, error)
FindUsers(ctx context.Context, find UserFinder) ([]*User, error)
AddUser(ctx context.Context, u *User) error
UpdateUser(ctx context.Context, upd UserUpdater) error
GetUser(ctx context.Context, user string) (*User, error)
GetUserSetting(ctx context.Context, user string) (*UserSetting, error)
UpdateUserSetting(ctx context.Context, upd UserSettingUpdater) error
FindUserData(ctx context.Context, find UserDataFinder) ([]*UserDataSection, error)
AddUserDataSection(ctx context.Context, user, section string) error
GetUserDataSection(ctx context.Context, user, section string) (*UserDataSection, error)
DeleteUserDataSection(ctx context.Context, user, section string) error
GetUserData(ctx context.Context, user, section, key string) (string, error)
SetUserData(ctx context.Context, user, section, key, value string) error
DeleteUserData(ctx context.Context, user, section, key string) error
UserRead(ctx context.Context, path string) error
UserWrite(ctx context.Context, path string) error
FindGroups(ctx context.Context, find GroupFinder) ([]*Group, error)
AddGroup(ctx context.Context, g *Group) error
UpdateGroup(ctx context.Context, upd GroupUpdater) error
FindGroupMembers(ctx context.Context, find MemberFinder) ([]*Member, error)
AddGroupMember(ctx context.Context, m *Member) error
DeleteGroupMember(ctx context.Context, group, member string) error
}
type Status ¶
Status indicates a status in an entry type. It should have css complient color information.
type StringSliceArranger ¶
type ThumbnailFinder ¶
type ThumbnailFinder struct {
EntryPath *string
}
type ThumbnailUpdater ¶
type UnauthorizedError ¶
type UnauthorizedError struct {
// contains filtered or unexported fields
}
func Unauthorized ¶
func Unauthorized(s string, is ...any) *UnauthorizedError
func (*UnauthorizedError) Error ¶
func (e *UnauthorizedError) Error() string
type UserDataFinder ¶
type UserDataSection ¶
UserDataSection includes some or all user data in a section. Unlike UserSetting, it could have arbitrary section and data, Parsing the data is left up to the clients.
type UserSetting ¶
type UserSetting struct {
ID int
User string
EntryPageHideSideMenu bool
EntryPageSelectedCategory string
EntryPageShowHiddenProperty string
EntryPageExpandProperty bool
EntryPageSearchEntryType string
EntryPagePropertyFilter map[string]string
EntryPageSortProperty map[string]string
PickedProperty map[string]string
PickedPropertyInputSize [2]int
QuickSearches []StringKV
PinnedPaths []string
RecentPaths []string
ProgramsInUse []string
UpdateMarkerLasts int
SearchView string
EntryGroupBy string
CopyPathRemap string
ShowArchived bool
}
type UserSettingFinder ¶
type UserSettingFinder struct {
User *string
}