Documentation
¶
Index ¶
- Variables
- type AssetControl
- func (ac *AssetControl) Create(ctx context.Context, cmd CreateAssetCmd) (*entities.Asset, error)
- func (ac *AssetControl) Delete(ctx context.Context, asset *entities.Asset) error
- func (ac *AssetControl) Get(ctx context.Context, query GetAssetQuery) (*entities.Asset, error)
- func (ac *AssetControl) List(ctx context.Context, query ListAssetsQuery) (*entities.ListPage[*entities.Asset], error)
- func (ac *AssetControl) Update(ctx context.Context, cmd UpdateAssetCmd) (*entities.Asset, error)
- type AssetRepo
- type AuthConfig
- type AuthController
- func (ac *AuthController) ChangeUserCredentials(ctx context.Context, cmd ChangeUserCredentialsCmd) (map[string]string, error)
- func (ac *AuthController) CreateUser(ctx context.Context, cmd CreateUserCmd) error
- func (ac *AuthController) DeleteUser(ctx context.Context, userID int64) error
- func (ac *AuthController) GetUserForCredentials(ctx context.Context, query GetUserForCredentialsQuery) (*auth.User, map[string]string, error)
- func (ac *AuthController) ResetPassword(ctx context.Context, cmd ResetPasswordCmd) error
- func (ac *AuthController) ToggleAdmin(ctx context.Context, id int64) error
- type CategoryCtrl
- type CategoryRepo
- type ChangeUserCredentialsCmd
- type CreateAssetCmd
- type CreateUserCmd
- type CustomAttrCtrl
- type CustomAttrRepo
- type ExportCmd
- type ExporterCtrl
- type FileBlobs
- type FileControl
- func (fc *FileControl) Delete(ctx context.Context, id int64) error
- func (fc *FileControl) DeleteAllForAsset(ctx context.Context, assetID int64) error
- func (fc *FileControl) DeleteByPublicPath(ctx context.Context, publicPath string) error
- func (fc *FileControl) Get(ctx context.Context, id int64) (*entities.File, error)
- func (fc *FileControl) List(ctx context.Context, query ListFilesQuery) (*entities.ListPage[*entities.File], error)
- func (fc *FileControl) WriteFile(ctx context.Context, file *entities.File) (*entities.File, error)
- type FileRepo
- type GenerateLabelSheetQuery
- type GetAssetQuery
- type GetUserForCredentialsQuery
- type ImportCmd
- type ImporterCtrl
- type ImporterCtrlConfig
- type LabelController
- type ListAssetsQuery
- type ListCategoriesQuery
- type ListCustomAttrsQuery
- type ListFilesQuery
- type ListLocationsQuery
- type ListManufacturersQuery
- type ListModelsQuery
- type ListPositionCodesQuery
- type ListSuppliersQuery
- type ListTagsQuery
- type ListUsersQuery
- type LocalAuthRepo
- type LocationControl
- type LocationRepo
- type ManufactuerCtrl
- type ManufactuerRepo
- type ModelCtrl
- type ModelRepo
- type ResetPasswordCmd
- type SupplierCtrl
- type SupplierRepo
- type TagControl
- func (tc *TagControl) CreateIfNotExists(ctx context.Context, tag string) (*entities.Tag, error)
- func (tc *TagControl) Delete(ctx context.Context, tag string) error
- func (tc *TagControl) Get(ctx context.Context, tag string) (*entities.Tag, error)
- func (tc *TagControl) GetNext(ctx context.Context) (string, error)
- func (tc *TagControl) List(ctx context.Context, query ListTagsQuery) (*entities.ListPage[*entities.Tag], error)
- func (tc *TagControl) MarkTagUnused(ctx context.Context, tag string) error
- type TagRepo
- type UpdateAssetCmd
- type UserControl
- func (cc *UserControl) CountAdmins(ctx context.Context) (int64, error)
- func (cc *UserControl) Create(ctx context.Context, user *auth.User) error
- func (cc *UserControl) Delete(ctx context.Context, id int64) error
- func (cc *UserControl) Get(ctx context.Context, id int64) (*auth.User, error)
- func (cc *UserControl) GetByRef(ctx context.Context, ref string) (*auth.User, error)
- func (cc *UserControl) GetByUsername(ctx context.Context, username string) (*auth.User, error)
- func (cc *UserControl) List(ctx context.Context, query ListUsersQuery) (*entities.ListPage[*auth.User], error)
- func (cc *UserControl) SetUserPreferences(ctx context.Context, user *auth.User) error
- func (cc *UserControl) Update(ctx context.Context, user *auth.User) error
- type UserRepo
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrAssetMissingTag = errors.New("asset is missing a tag")
View Source
var ErrAssetNotFound = errors.New("asset not found")
View Source
var ErrDeleteAsset = errors.New("error deleting asset")
View Source
var ErrFileNotFound = errors.New("file not found")
View Source
var ErrInvalidCredentials = errors.New("invalid credentials")
View Source
var ErrInvalidTag = errors.New("invalid tag")
View Source
var ErrPasswordEmpty = errors.New("password must not be empty")
View Source
var ErrUserNotFound = errors.New("user not found")
View Source
var ErrUsernameEmpty = errors.New("username must not be empty")
Functions ¶
This section is empty.
Types ¶
type AssetControl ¶
type AssetControl struct {
// contains filtered or unexported fields
}
func NewAssetControl ¶
func NewAssetControl(db *database.Database, tags *TagControl, files *FileControl, repo AssetRepo) *AssetControl
func (*AssetControl) Create ¶
func (ac *AssetControl) Create(ctx context.Context, cmd CreateAssetCmd) (*entities.Asset, error)
func (*AssetControl) Get ¶
func (ac *AssetControl) Get(ctx context.Context, query GetAssetQuery) (*entities.Asset, error)
func (*AssetControl) List ¶
func (ac *AssetControl) List(ctx context.Context, query ListAssetsQuery) (*entities.ListPage[*entities.Asset], error)
func (*AssetControl) Update ¶
func (ac *AssetControl) Update(ctx context.Context, cmd UpdateAssetCmd) (*entities.Asset, error)
type AssetRepo ¶
type AssetRepo interface { Get(ctx context.Context, exec bob.Executor, query database.GetAssetQuery) (*entities.Asset, error) List(ctx context.Context, exec bob.Executor, query database.ListAssetsQuery) (*entities.ListPage[*entities.Asset], error) Create(ctx context.Context, exec bob.Executor, asset *entities.Asset) error Update(ctx context.Context, exec bob.Executor, asset *entities.Asset) error Delete(ctx context.Context, exec bob.Executor, id int64) error }
type AuthConfig ¶
type AuthConfig struct {
Argon2Params auth.Argon2Params
}
type AuthController ¶
type AuthController struct {
// contains filtered or unexported fields
}
func NewAuthController ¶
func NewAuthController(config AuthConfig, db *database.Database, users *UserControl, localAuth LocalAuthRepo) *AuthController
func (*AuthController) ChangeUserCredentials ¶
func (ac *AuthController) ChangeUserCredentials(ctx context.Context, cmd ChangeUserCredentialsCmd) (map[string]string, error)
func (*AuthController) CreateUser ¶
func (ac *AuthController) CreateUser(ctx context.Context, cmd CreateUserCmd) error
func (*AuthController) DeleteUser ¶
func (ac *AuthController) DeleteUser(ctx context.Context, userID int64) error
func (*AuthController) GetUserForCredentials ¶
func (ac *AuthController) GetUserForCredentials(ctx context.Context, query GetUserForCredentialsQuery) (*auth.User, map[string]string, error)
func (*AuthController) ResetPassword ¶
func (ac *AuthController) ResetPassword(ctx context.Context, cmd ResetPasswordCmd) error
func (*AuthController) ToggleAdmin ¶
func (ac *AuthController) ToggleAdmin(ctx context.Context, id int64) error
type CategoryCtrl ¶
type CategoryCtrl struct {
// contains filtered or unexported fields
}
func NewCategoryCtrl ¶
func NewCategoryCtrl(db *database.Database, repo CategoryRepo) *CategoryCtrl
type CategoryRepo ¶
type CreateUserCmd ¶
type CustomAttrCtrl ¶
type CustomAttrCtrl struct {
// contains filtered or unexported fields
}
func NewCustomAttrCtrl ¶
func NewCustomAttrCtrl(db *database.Database, repo CustomAttrRepo) *CustomAttrCtrl
func (*CustomAttrCtrl) List ¶
func (cac *CustomAttrCtrl) List(ctx context.Context, query ListCustomAttrsQuery) (*entities.ListPage[*entities.CustomAttr], error)
type CustomAttrRepo ¶
type ExporterCtrl ¶
type ExporterCtrl struct {
// contains filtered or unexported fields
}
func NewExporterCtrl ¶
func NewExporterCtrl(db *database.Database, assets *AssetControl) *ExporterCtrl
type FileControl ¶
type FileControl struct {
// contains filtered or unexported fields
}
func NewFileControl ¶
func NewFileControl(db *database.Database, repo FileRepo, blobs FileBlobs) *FileControl
func (*FileControl) DeleteAllForAsset ¶
func (fc *FileControl) DeleteAllForAsset(ctx context.Context, assetID int64) error
func (*FileControl) DeleteByPublicPath ¶
func (fc *FileControl) DeleteByPublicPath(ctx context.Context, publicPath string) error
type FileRepo ¶
type FileRepo interface { Get(ctx context.Context, exec bob.Executor, id int64) (*entities.File, error) GetByPublicPath(ctx context.Context, exec bob.Executor, publicPath string) (*entities.File, error) List(ctx context.Context, exec bob.Executor, query database.ListFilesQuery) (*entities.ListPage[*entities.File], error) Create(ctx context.Context, exec bob.Executor, file *entities.File) (int64, error) Delete(ctx context.Context, exec bob.Executor, ids []int64) error }
type GenerateLabelSheetQuery ¶
type GetAssetQuery ¶
type ImporterCtrl ¶
type ImporterCtrl struct {
// contains filtered or unexported fields
}
func NewImporterCtrl ¶
func NewImporterCtrl(config ImporterCtrlConfig, db *database.Database, assets *AssetControl, tags *TagControl) *ImporterCtrl
type ImporterCtrlConfig ¶ added in v0.3.1
type ImporterCtrlConfig struct {
DefaultCurrency string
}
type LabelController ¶
type LabelController struct {
// contains filtered or unexported fields
}
func NewLabelController ¶
func NewLabelController(assets *AssetControl) *LabelController
func (*LabelController) GenerateLabelSheet ¶
func (lc *LabelController) GenerateLabelSheet(ctx context.Context, query GenerateLabelSheetQuery) ([]byte, error)
type ListAssetsQuery ¶
type ListCategoriesQuery ¶
type ListCustomAttrsQuery ¶
type ListFilesQuery ¶
type ListLocationsQuery ¶
type ListManufacturersQuery ¶
type ListModelsQuery ¶
type ListPositionCodesQuery ¶
type ListSuppliersQuery ¶
type ListTagsQuery ¶
type ListUsersQuery ¶
type LocalAuthRepo ¶
type LocalAuthRepo interface { Get(ctx context.Context, tx bob.Executor, username string) (*auth.LocalAuthUser, error) Create(ctx context.Context, tx bob.Executor, user *auth.LocalAuthUser) error Update(ctx context.Context, tx bob.Executor, user *auth.LocalAuthUser) error DeleteByUsername(ctx context.Context, tx bob.Executor, username string) error }
type LocationControl ¶
type LocationControl struct {
// contains filtered or unexported fields
}
func NewLocationControl ¶
func NewLocationControl(db *database.Database, repo LocationRepo) *LocationControl
func (*LocationControl) ListLocations ¶
func (lc *LocationControl) ListLocations(ctx context.Context, query ListLocationsQuery) (*entities.ListPage[*entities.Location], error)
func (*LocationControl) ListPositionCodes ¶
func (lc *LocationControl) ListPositionCodes(ctx context.Context, query ListPositionCodesQuery) (*entities.ListPage[*entities.PositionCode], error)
type LocationRepo ¶
type LocationRepo interface { ListLocations(ctx context.Context, exec bob.Executor, query database.ListLocationsQuery) (*entities.ListPage[*entities.Location], error) ListPositionCodes(ctx context.Context, exec bob.Executor, query database.ListPositionCodesQuery) (*entities.ListPage[*entities.PositionCode], error) }
type ManufactuerCtrl ¶
type ManufactuerCtrl struct {
// contains filtered or unexported fields
}
func NewManufactuerCtrl ¶
func NewManufactuerCtrl(db *database.Database, repo ManufactuerRepo) *ManufactuerCtrl
func (*ManufactuerCtrl) List ¶
func (cc *ManufactuerCtrl) List(ctx context.Context, query ListManufacturersQuery) (*entities.ListPage[*entities.Manufacturer], error)
type ManufactuerRepo ¶
type ResetPasswordCmd ¶
type SupplierCtrl ¶
type SupplierCtrl struct {
// contains filtered or unexported fields
}
func NewSupplierCtrl ¶
func NewSupplierCtrl(db *database.Database, repo SupplierRepo) *SupplierCtrl
type SupplierRepo ¶
type TagControl ¶
type TagControl struct {
// contains filtered or unexported fields
}
func NewTagControl ¶
func NewTagControl(db *database.Database, algorithm string, repo TagRepo) *TagControl
func (*TagControl) CreateIfNotExists ¶
func (*TagControl) List ¶
func (tc *TagControl) List(ctx context.Context, query ListTagsQuery) (*entities.ListPage[*entities.Tag], error)
func (*TagControl) MarkTagUnused ¶
func (tc *TagControl) MarkTagUnused(ctx context.Context, tag string) error
type TagRepo ¶
type TagRepo interface { List(ctx context.Context, exec bob.Executor, query database.ListTagsQuery) (*entities.ListPage[*entities.Tag], error) GetUnused(ctx context.Context, exec bob.Executor) (*entities.Tag, error) Get(ctx context.Context, exec bob.Executor, tag string) (*entities.Tag, error) Create(ctx context.Context, exec bob.Executor, tag *entities.Tag) error MarkTagUsed(ctx context.Context, exec bob.Executor, tag string) error MarkTagUnused(ctx context.Context, exec bob.Executor, tag string) error Delete(ctx context.Context, exec bob.Executor, tag string) error NextSequential(ctx context.Context, exec bob.Executor) (int64, error) }
type UserControl ¶
type UserControl struct {
// contains filtered or unexported fields
}
func NewUserCtrl ¶
func NewUserCtrl(db *database.Database, repo UserRepo) *UserControl
func (*UserControl) CountAdmins ¶
func (cc *UserControl) CountAdmins(ctx context.Context) (int64, error)
func (*UserControl) GetByUsername ¶
func (*UserControl) List ¶
func (cc *UserControl) List(ctx context.Context, query ListUsersQuery) (*entities.ListPage[*auth.User], error)
func (*UserControl) SetUserPreferences ¶ added in v0.7.0
type UserRepo ¶
type UserRepo interface { List(ctx context.Context, exec bob.Executor, query database.ListUsersQuery) (*entities.ListPage[*auth.User], error) Create(ctx context.Context, exec bob.Executor, user *auth.User) error Update(ctx context.Context, exec bob.Executor, user *auth.User) error Get(ctx context.Context, exec bob.Executor, id int64) (*auth.User, error) GetByUsername(ctx context.Context, exec bob.Executor, username string) (*auth.User, error) GetByRef(ctx context.Context, exec bob.Executor, ref string) (*auth.User, error) CountAdmins(ctx context.Context, exec bob.Executor) (int64, error) Delete(ctx context.Context, exec bob.Executor, id int64) error UpsertPreferences(ctx context.Context, exec bob.Executor, user *auth.User) error }
Click to show internal directories.
Click to hide internal directories.