Documentation
¶
Index ¶
- Constants
- func ConvertRowStatusStringToStorepb(status string) storepb.RowStatus
- func ConvertVisibilityStringToStorepb(visibility string) storepb.Visibility
- type Activity
- type ActivityLevel
- type ActivityType
- type DeleteCollection
- type DeleteShortcut
- type DeleteUser
- type Driver
- type FindActivity
- type FindCollection
- type FindMigrationHistory
- type FindShortcut
- type FindUser
- type FindUserSetting
- type FindWorkspaceSetting
- type MigrationHistory
- type Role
- type Store
- func (s *Store) Close() error
- func (s *Store) CreateActivity(ctx context.Context, create *Activity) (*Activity, error)
- func (s *Store) CreateCollection(ctx context.Context, create *storepb.Collection) (*storepb.Collection, error)
- func (s *Store) CreateShortcut(ctx context.Context, create *storepb.Shortcut) (*storepb.Shortcut, error)
- func (s *Store) CreateUser(ctx context.Context, create *User) (*User, error)
- func (s *Store) DeleteCollection(ctx context.Context, delete *DeleteCollection) error
- func (s *Store) DeleteShortcut(ctx context.Context, delete *DeleteShortcut) error
- func (s *Store) DeleteUser(ctx context.Context, delete *DeleteUser) error
- func (s *Store) DeleteWorkspaceSetting(ctx context.Context, key storepb.WorkspaceSettingKey) error
- func (s *Store) GetActivity(ctx context.Context, find *FindActivity) (*Activity, error)
- func (s *Store) GetCollection(ctx context.Context, find *FindCollection) (*storepb.Collection, error)
- func (s *Store) GetCurrentSchemaVersion() (string, error)
- func (s *Store) GetShortcut(ctx context.Context, find *FindShortcut) (*storepb.Shortcut, error)
- func (s *Store) GetUser(ctx context.Context, find *FindUser) (*User, error)
- func (s *Store) GetUserAccessTokens(ctx context.Context, userID int32) ([]*storepb.UserSetting_AccessTokensSetting_AccessToken, error)
- func (s *Store) GetUserSetting(ctx context.Context, find *FindUserSetting) (*storepb.UserSetting, error)
- func (s *Store) GetWorkspaceGeneralSetting(ctx context.Context) (*storepb.WorkspaceSetting_GeneralSetting, error)
- func (s *Store) GetWorkspaceSecuritySetting(ctx context.Context) (*storepb.WorkspaceSetting_SecuritySetting, error)
- func (s *Store) GetWorkspaceSetting(ctx context.Context, find *FindWorkspaceSetting) (*storepb.WorkspaceSetting, error)
- func (s *Store) ListActivities(ctx context.Context, find *FindActivity) ([]*Activity, error)
- func (s *Store) ListCollections(ctx context.Context, find *FindCollection) ([]*storepb.Collection, error)
- func (s *Store) ListShortcuts(ctx context.Context, find *FindShortcut) ([]*storepb.Shortcut, error)
- func (s *Store) ListUserSettings(ctx context.Context, find *FindUserSetting) ([]*storepb.UserSetting, error)
- func (s *Store) ListUsers(ctx context.Context, find *FindUser) ([]*User, error)
- func (s *Store) ListWorkspaceSettings(ctx context.Context, find *FindWorkspaceSetting) ([]*storepb.WorkspaceSetting, error)
- func (s *Store) Migrate(ctx context.Context) error
- func (s *Store) UpdateCollection(ctx context.Context, update *UpdateCollection) (*storepb.Collection, error)
- func (s *Store) UpdateShortcut(ctx context.Context, update *UpdateShortcut) (*storepb.Shortcut, error)
- func (s *Store) UpdateUser(ctx context.Context, update *UpdateUser) (*User, error)
- func (s *Store) UpsertUserSetting(ctx context.Context, upsert *storepb.UserSetting) (*storepb.UserSetting, error)
- func (s *Store) UpsertWorkspaceSetting(ctx context.Context, upsert *storepb.WorkspaceSetting) (*storepb.WorkspaceSetting, error)
- type UpdateCollection
- type UpdateShortcut
- type UpdateUser
- type UpsertMigrationHistory
- type User
Constants ¶
View Source
const ( // MigrateFileNameSplit is the split character between the patch version and the description in the migration file name. // For example, "1__create_table.sql". MigrateFileNameSplit = "__" // LatestSchemaFileName is the name of the latest schema file. // This file is used to apply the latest schema when no migration history is found. LatestSchemaFileName = "LATEST.sql" )
Variables ¶
This section is empty.
Functions ¶
func ConvertVisibilityStringToStorepb ¶
func ConvertVisibilityStringToStorepb(visibility string) storepb.Visibility
Types ¶
type Activity ¶
type Activity struct {
ID int32
CreatorID int32
CreatedTs int64
Type ActivityType
Level ActivityLevel
Payload string
}
type ActivityLevel ¶
type ActivityLevel string
const ( // ActivityInfo is the activity level of info. ActivityInfo ActivityLevel = "INFO" // ActivityWarn is the activity level of warn. ActivityWarn ActivityLevel = "WARN" // ActivityError is the activity level of error. ActivityError ActivityLevel = "ERROR" )
func (ActivityLevel) String ¶
func (l ActivityLevel) String() string
type ActivityType ¶
type ActivityType string
const ( // ActivityShortcutView is the activity type of shortcut create. ActivityShortcutCreate ActivityType = "shortcut.create" // ActivityShortcutView is the activity type of shortcut view. ActivityShortcutView ActivityType = "shortcut.view" )
func (ActivityType) String ¶
func (t ActivityType) String() string
type DeleteCollection ¶
type DeleteCollection struct {
ID int32
}
type DeleteShortcut ¶
type DeleteShortcut struct {
ID int32
}
type DeleteUser ¶
type DeleteUser struct {
ID int32
}
type Driver ¶
type Driver interface {
GetDB() *sql.DB
Close() error
// MigrationHistory model related methods.
UpsertMigrationHistory(ctx context.Context, upsert *UpsertMigrationHistory) (*MigrationHistory, error)
ListMigrationHistories(ctx context.Context, find *FindMigrationHistory) ([]*MigrationHistory, error)
// Activity model related methods.
CreateActivity(ctx context.Context, create *Activity) (*Activity, error)
ListActivities(ctx context.Context, find *FindActivity) ([]*Activity, error)
// Collection model related methods.
CreateCollection(ctx context.Context, create *storepb.Collection) (*storepb.Collection, error)
UpdateCollection(ctx context.Context, update *UpdateCollection) (*storepb.Collection, error)
ListCollections(ctx context.Context, find *FindCollection) ([]*storepb.Collection, error)
DeleteCollection(ctx context.Context, delete *DeleteCollection) error
// Shortcut model related methods.
CreateShortcut(ctx context.Context, create *storepb.Shortcut) (*storepb.Shortcut, error)
UpdateShortcut(ctx context.Context, update *UpdateShortcut) (*storepb.Shortcut, error)
ListShortcuts(ctx context.Context, find *FindShortcut) ([]*storepb.Shortcut, error)
DeleteShortcut(ctx context.Context, delete *DeleteShortcut) error
// User model related methods.
CreateUser(ctx context.Context, create *User) (*User, error)
UpdateUser(ctx context.Context, update *UpdateUser) (*User, error)
ListUsers(ctx context.Context, find *FindUser) ([]*User, error)
DeleteUser(ctx context.Context, delete *DeleteUser) error
// UserSetting model related methods.
UpsertUserSetting(ctx context.Context, upsert *storepb.UserSetting) (*storepb.UserSetting, error)
ListUserSettings(ctx context.Context, find *FindUserSetting) ([]*storepb.UserSetting, error)
// WorkspaceSetting model related methods.
UpsertWorkspaceSetting(ctx context.Context, upsert *storepb.WorkspaceSetting) (*storepb.WorkspaceSetting, error)
ListWorkspaceSettings(ctx context.Context, find *FindWorkspaceSetting) ([]*storepb.WorkspaceSetting, error)
DeleteWorkspaceSetting(ctx context.Context, key storepb.WorkspaceSettingKey) error
}
Driver is an interface for store driver. It contains all methods that store database driver should implement.
type FindActivity ¶
type FindActivity struct {
Type ActivityType
Level ActivityLevel
PayloadShortcutID *int32
CreatedTsAfter *int64
}
type FindCollection ¶
type FindCollection struct {
ID *int32
CreatorID *int32
Name *string
VisibilityList []storepb.Visibility
}
type FindMigrationHistory ¶
type FindMigrationHistory struct {
}
type FindShortcut ¶
type FindUserSetting ¶
type FindUserSetting struct {
UserID *int32
Key storepb.UserSettingKey
}
type FindWorkspaceSetting ¶
type FindWorkspaceSetting struct {
Key storepb.WorkspaceSettingKey
}
type MigrationHistory ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store provides database access to all raw objects.
func (*Store) CreateActivity ¶
func (*Store) CreateCollection ¶
func (s *Store) CreateCollection(ctx context.Context, create *storepb.Collection) (*storepb.Collection, error)
func (*Store) CreateShortcut ¶
func (*Store) CreateUser ¶
func (*Store) DeleteCollection ¶
func (s *Store) DeleteCollection(ctx context.Context, delete *DeleteCollection) error
func (*Store) DeleteShortcut ¶
func (s *Store) DeleteShortcut(ctx context.Context, delete *DeleteShortcut) error
func (*Store) DeleteUser ¶
func (s *Store) DeleteUser(ctx context.Context, delete *DeleteUser) error
func (*Store) DeleteWorkspaceSetting ¶
func (*Store) GetActivity ¶
func (*Store) GetCollection ¶
func (s *Store) GetCollection(ctx context.Context, find *FindCollection) (*storepb.Collection, error)
func (*Store) GetCurrentSchemaVersion ¶
func (*Store) GetShortcut ¶
func (*Store) GetUserAccessTokens ¶
func (s *Store) GetUserAccessTokens(ctx context.Context, userID int32) ([]*storepb.UserSetting_AccessTokensSetting_AccessToken, error)
GetUserAccessTokens returns the access tokens of the user.
func (*Store) GetUserSetting ¶
func (s *Store) GetUserSetting(ctx context.Context, find *FindUserSetting) (*storepb.UserSetting, error)
func (*Store) GetWorkspaceGeneralSetting ¶
func (*Store) GetWorkspaceSecuritySetting ¶
func (*Store) GetWorkspaceSetting ¶
func (s *Store) GetWorkspaceSetting(ctx context.Context, find *FindWorkspaceSetting) (*storepb.WorkspaceSetting, error)
func (*Store) ListActivities ¶
func (*Store) ListCollections ¶
func (s *Store) ListCollections(ctx context.Context, find *FindCollection) ([]*storepb.Collection, error)
func (*Store) ListShortcuts ¶
func (*Store) ListUserSettings ¶
func (s *Store) ListUserSettings(ctx context.Context, find *FindUserSetting) ([]*storepb.UserSetting, error)
func (*Store) ListWorkspaceSettings ¶
func (s *Store) ListWorkspaceSettings(ctx context.Context, find *FindWorkspaceSetting) ([]*storepb.WorkspaceSetting, error)
func (*Store) UpdateCollection ¶
func (s *Store) UpdateCollection(ctx context.Context, update *UpdateCollection) (*storepb.Collection, error)
func (*Store) UpdateShortcut ¶
func (*Store) UpdateUser ¶
func (*Store) UpsertUserSetting ¶
func (s *Store) UpsertUserSetting(ctx context.Context, upsert *storepb.UserSetting) (*storepb.UserSetting, error)
func (*Store) UpsertWorkspaceSetting ¶
func (s *Store) UpsertWorkspaceSetting(ctx context.Context, upsert *storepb.WorkspaceSetting) (*storepb.WorkspaceSetting, error)
type UpdateCollection ¶
type UpdateShortcut ¶
type UpdateShortcut struct {
ID int32
Name *string
Link *string
Title *string
Description *string
Visibility *storepb.Visibility
Tag *string
OpenGraphMetadata *storepb.OpenGraphMetadata
}
type UpdateUser ¶
type UpsertMigrationHistory ¶
type UpsertMigrationHistory struct {
Version string
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.