Documentation
¶
Index ¶
- func InitGlobalClient(initFunc func() (Client, error)) error
- func IsDuplicateAttributeError(err error) bool
- func NewAppId() string
- func NewAppName() string
- func SortAppsByAccessedTime(apps []*App)
- func SortAppsByCreatedTime(apps []*App)
- type Api
- type App
- type AppsByAccessedTime
- type AppsByCreatedTime
- type Client
- type DummyClient
- func (mc *DummyClient) DeleteApp(id string) error
- func (mc *DummyClient) GetApi(id string) (*Api, error)
- func (mc *DummyClient) GetApis() ([]*Api, error)
- func (mc *DummyClient) GetApisByIds(ids []string) ([]*Api, error)
- func (mc *DummyClient) GetApp(id string) (*App, error)
- func (mc *DummyClient) GetAppByName(name string) (*App, error)
- func (mc *DummyClient) GetAppByWorktreeId(worktreeId string) (*App, error)
- func (mc *DummyClient) GetAppsByUserId(userId string) ([]*App, error)
- func (mc *DummyClient) GetGalleryApps(limit int) ([]*App, error)
- func (mc *DummyClient) NewApp(app *App) (*App, error)
- func (mc *DummyClient) UpdateApp(app *App, fields []string) error
- func (mc *DummyClient) UpdateAppDescription(app *App, newDescription string) error
- func (mc *DummyClient) UpdateAppName(app *App, newName string) error
- func (mc *DummyClient) UpdateAppRunningTimestamp(app *App) error
- func (mc *DummyClient) UpdateAppSourceTimestamp(app *App) error
- type ErrorDuplicateAttribute
- type KeyValuePair
- type MongodbClient
- func (mc *MongodbClient) DeleteApp(id string) error
- func (mc *MongodbClient) GetApi(id string) (*Api, error)
- func (mc *MongodbClient) GetApis() ([]*Api, error)
- func (mc *MongodbClient) GetApisByIds(ids []string) ([]*Api, error)
- func (mc *MongodbClient) GetApp(id string) (*App, error)
- func (mc *MongodbClient) GetAppByName(name string) (*App, error)
- func (mc *MongodbClient) GetAppByWorktreeId(worktreeId string) (*App, error)
- func (mc *MongodbClient) GetAppsByUserId(userId string) ([]*App, error)
- func (mc *MongodbClient) GetGalleryApps(limit int) ([]*App, error)
- func (mc *MongodbClient) NewApp(app *App) (*App, error)
- func (mc *MongodbClient) UpdateApp(app *App, fields []string) error
- func (mc *MongodbClient) UpdateAppDescription(app *App, newDescription string) error
- func (mc *MongodbClient) UpdateAppName(app *App, newName string) error
- func (mc *MongodbClient) UpdateAppRunningTimestamp(app *App) error
- func (mc *MongodbClient) UpdateAppSourceTimestamp(app *App) error
- type User
- type UserClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitGlobalClient ¶
func NewAppName ¶
func NewAppName() string
func SortAppsByAccessedTime ¶
func SortAppsByAccessedTime(apps []*App)
func SortAppsByCreatedTime ¶
func SortAppsByCreatedTime(apps []*App)
Types ¶
type Api ¶
type Api struct {
Id string `bson:"_id"`
Name string `bson:"name"`
LogoUrl string `bson:"logo_url"`
Description string `bson:"description"`
PortalUrl string `bson:"portal_url"`
Tags []string `bson:"tags"`
Packages []string `bson:"packages"`
RequiredEnvVarKeys []string `bson:"required_env_var_keys"`
OptionalEnvVarKeys []string `bson:"optional_env_var_keys"`
Snippet string `bson:"snippet"`
}
type App ¶
type App struct {
// Metadata
Id string `bson:"_id"`
Description string `bson:"description"`
Icon string `bson:"icon"`
UserId string `bson:"user_id"`
Name string `bson:"name"`
WorktreeId string `bson:"worktree_id"`
CreatedTime time.Time `bson:"created_time"`
AccessedTime time.Time `bson:"accessed_time"`
Private bool `bson:"private"`
StartCmd string `bson:"start_cmd"`
EnvVars []KeyValuePair `bson:"env_vars"`
Gallery bool `bson:"gallery"`
// APIs enabled for this app
ApiIds []string `bson:"api_ids"`
SourceTimestamp int64 `bson:"source_timestamp"`
RunningTimestamp int64 `bson:"running_timestamp"`
}
func (*App) GetSystemEnvVarMap ¶
type AppsByAccessedTime ¶
type AppsByAccessedTime []*App
func (AppsByAccessedTime) Len ¶
func (bat AppsByAccessedTime) Len() int
func (AppsByAccessedTime) Less ¶
func (bat AppsByAccessedTime) Less(i, j int) bool
func (AppsByAccessedTime) Swap ¶
func (bat AppsByAccessedTime) Swap(i, j int)
type AppsByCreatedTime ¶
type AppsByCreatedTime []*App
func (AppsByCreatedTime) Len ¶
func (bct AppsByCreatedTime) Len() int
func (AppsByCreatedTime) Less ¶
func (bct AppsByCreatedTime) Less(i, j int) bool
func (AppsByCreatedTime) Swap ¶
func (bct AppsByCreatedTime) Swap(i, j int)
type Client ¶
type Client interface {
// App functions
NewApp(app *App) (*App, error)
UpdateApp(app *App, fields []string) error
UpdateAppName(app *App, newName string) error
UpdateAppDescription(app *App, newDescription string) error
UpdateAppSourceTimestamp(app *App) error
UpdateAppRunningTimestamp(app *App) error
GetApp(id string) (*App, error)
GetAppByName(name string) (*App, error)
GetAppsByUserId(userId string) ([]*App, error)
GetAppByWorktreeId(worktreeId string) (*App, error)
GetGalleryApps(limit int) ([]*App, error)
DeleteApp(id string) error
// User functions
GetUser(id string) (*User, error)
// Api functions
GetApis() ([]*Api, error)
GetApi(id string) (*Api, error)
GetApisByIds(ids []string) ([]*Api, error)
}
func NewDummyClient ¶
func NewDummyClient() Client
func NewMongodbClient ¶
type DummyClient ¶
type DummyClient struct {
UserClient
Mutex sync.RWMutex
IdToAppMap map[string]*App
NameToAppMap map[string]*App
WorktreeToAppMap map[string]*App
IdToApiMap map[string]*Api
}
Dummy implementation of the client, for development only.
func (*DummyClient) DeleteApp ¶
func (mc *DummyClient) DeleteApp(id string) error
func (*DummyClient) GetApis ¶
func (mc *DummyClient) GetApis() ([]*Api, error)
func (*DummyClient) GetApisByIds ¶
func (mc *DummyClient) GetApisByIds(ids []string) ([]*Api, error)
func (*DummyClient) GetAppByName ¶
func (mc *DummyClient) GetAppByName(name string) (*App, error)
func (*DummyClient) GetAppByWorktreeId ¶
func (mc *DummyClient) GetAppByWorktreeId(worktreeId string) (*App, error)
func (*DummyClient) GetAppsByUserId ¶
func (mc *DummyClient) GetAppsByUserId(userId string) ([]*App, error)
func (*DummyClient) GetGalleryApps ¶
func (mc *DummyClient) GetGalleryApps(limit int) ([]*App, error)
func (*DummyClient) UpdateAppDescription ¶
func (mc *DummyClient) UpdateAppDescription(app *App, newDescription string) error
func (*DummyClient) UpdateAppName ¶
func (mc *DummyClient) UpdateAppName(app *App, newName string) error
func (*DummyClient) UpdateAppRunningTimestamp ¶
func (mc *DummyClient) UpdateAppRunningTimestamp(app *App) error
func (*DummyClient) UpdateAppSourceTimestamp ¶
func (mc *DummyClient) UpdateAppSourceTimestamp(app *App) error
type ErrorDuplicateAttribute ¶
type ErrorDuplicateAttribute string
func (ErrorDuplicateAttribute) Error ¶
func (ead ErrorDuplicateAttribute) Error() string
type KeyValuePair ¶
type MongodbClient ¶
type MongodbClient struct {
UserClient
// contains filtered or unexported fields
}
func (*MongodbClient) DeleteApp ¶
func (mc *MongodbClient) DeleteApp(id string) error
func (*MongodbClient) GetApis ¶
func (mc *MongodbClient) GetApis() ([]*Api, error)
func (*MongodbClient) GetApisByIds ¶
func (mc *MongodbClient) GetApisByIds(ids []string) ([]*Api, error)
func (*MongodbClient) GetAppByName ¶
func (mc *MongodbClient) GetAppByName(name string) (*App, error)
func (*MongodbClient) GetAppByWorktreeId ¶
func (mc *MongodbClient) GetAppByWorktreeId(worktreeId string) (*App, error)
func (*MongodbClient) GetAppsByUserId ¶
func (mc *MongodbClient) GetAppsByUserId(userId string) ([]*App, error)
func (*MongodbClient) GetGalleryApps ¶
func (mc *MongodbClient) GetGalleryApps(limit int) ([]*App, error)
func (*MongodbClient) UpdateApp ¶
func (mc *MongodbClient) UpdateApp(app *App, fields []string) error
func (*MongodbClient) UpdateAppDescription ¶
func (mc *MongodbClient) UpdateAppDescription(app *App, newDescription string) error
func (*MongodbClient) UpdateAppName ¶
func (mc *MongodbClient) UpdateAppName(app *App, newName string) error
func (*MongodbClient) UpdateAppRunningTimestamp ¶
func (mc *MongodbClient) UpdateAppRunningTimestamp(app *App) error
func (*MongodbClient) UpdateAppSourceTimestamp ¶
func (mc *MongodbClient) UpdateAppSourceTimestamp(app *App) error
type UserClient ¶
func (*UserClient) RenewToken ¶
func (uc *UserClient) RenewToken() error
Click to show internal directories.
Click to hide internal directories.