Documentation
¶
Index ¶
- func Admin(u *User) boolean.Wrapper
- func ApplyDelta(oldData []byte, deltas []Delta) ([]byte, error)
- func ApplyVersionToContent(fileContent []byte, version FileVersion) ([]byte, error)
- func ConvertFileToTypes(file *File) *types.File
- func ConvertFileVersionToTypes(version *FileVersion) *types.FileVersion
- func ConvertFileVersionsToTypes(versions []FileVersion) []types.FileVersion
- func ConvertFilesToTypes(files []File) []types.File
- func ConvertUserToTypes(user *User) *types.User
- func NewTxAdapter(tx *sqlx.Tx) types.Tx
- func SerializeDelta(deltas []Delta) ([]byte, error)
- type Delta
- type File
- type FileMetadata
- type FileVersion
- type Properties
- type Storage
- func (s *Storage) AddFile(f *File) error
- func (s *Storage) AddFileTx(tx *sqlx.Tx, f *File) error
- func (s *Storage) AddFileVersion(version FileVersion) error
- func (s *Storage) BeginTx() (*Tx, error)
- func (s *Storage) CheckUser(username string) (bool, error)
- func (s *Storage) CloseDatabase() error
- func (s *Storage) DeleteAllFiles(userID int) error
- func (s *Storage) DeleteFile(f *File) error
- func (s *Storage) DeleteFileVersion(fileID int, version int) error
- func (s *Storage) DeleteFileVersions(fileID int) error
- func (s *Storage) DeleteUser(username string) error
- func (s *Storage) GetAllFiles(userID int) ([]File, error)
- func (s *Storage) GetAllUsers() ([]User, error)
- func (s *Storage) GetFile(userID int, filename string) (*File, error)
- func (s *Storage) GetFileHistory(fileID int) ([]FileVersion, error)
- func (s *Storage) GetFileVersion(fileID int, version int) (FileVersion, error)
- func (s *Storage) GetFileVersions(fileID int) ([]FileVersion, error)
- func (s *Storage) GetImageFiles(userID int) ([]File, error)
- func (s *Storage) GetLastFileVersion(fileID int) (FileVersion, error)
- func (s *Storage) GetUser(username string) (User, error)
- func (s *Storage) Query(command string) (*sql.Rows, error)
- func (s *Storage) RenameFile(f *File) error
- func (s *Storage) RestoreFileToVersion(fileID int, targetVersion int) ([]byte, error)
- func (s *Storage) SaveNewUser(u *User) error
- func (s *Storage) UpdateFile(f *File, newData []byte) error
- func (s *Storage) UpdateFileMetadata(userID int, req struct{ ... }) error
- func (s *Storage) UpdateUserInfo(username string, updates map[string]interface{}) error
- type Tx
- type TxAdapter
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyVersionToContent ¶
func ApplyVersionToContent(fileContent []byte, version FileVersion) ([]byte, error)
func ConvertFileToTypes ¶
func ConvertFileVersionToTypes ¶
func ConvertFileVersionToTypes(version *FileVersion) *types.FileVersion
func ConvertFileVersionsToTypes ¶
func ConvertFileVersionsToTypes(versions []FileVersion) []types.FileVersion
func ConvertFilesToTypes ¶
func ConvertUserToTypes ¶
func SerializeDelta ¶
Types ¶
type Delta ¶
type Delta struct {
Offset int // Смещение, где начинается изменение
Data []byte // Новые данные
Length int // Количество байтов для удаления (если 0 — просто вставка)
}
func DeserializeDelta ¶
type File ¶
type File struct {
ID int `db:"id" json:"id"`
UserID int `db:"user_id" json:"user_id"`
LastVersionID int `db:"last_version_id" json:"last_version_id"`
Metadata FileMetadata
Status string `db:"status" json:"status"`
Data []byte `db:"data" json:"data"`
CreatedAt time.Time `db:"created_at" json:"created_at"`
ModifiedAt time.Time `db:"last_modified_at" json:"modified_at"`
}
func ConvertFileFromTypes ¶
func ConvertFilesFromTypes ¶
type FileMetadata ¶
type FileVersion ¶
type FileVersion struct {
FileID int `db:"file_id"`
UserID int `db:"user_id"`
Version int `db:"version"`
FullVersion bool `db:"full_version"`
Delta []byte `db:"delta"`
ChangeType string `db:"change_type"`
CreatedAt time.Time `db:"created_at"`
}
func ConvertFileVersionFromTypes ¶
func ConvertFileVersionFromTypes(version *types.FileVersion) *FileVersion
type Properties ¶
type Properties struct {
}
type Storage ¶
func (*Storage) AddFileVersion ¶
func (s *Storage) AddFileVersion(version FileVersion) error
func (*Storage) CloseDatabase ¶
func (*Storage) DeleteAllFiles ¶
func (*Storage) DeleteFile ¶
func (*Storage) DeleteFileVersion ¶
func (*Storage) DeleteFileVersions ¶
func (*Storage) DeleteUser ¶
func (*Storage) GetAllUsers ¶
func (*Storage) GetFileHistory ¶
func (s *Storage) GetFileHistory(fileID int) ([]FileVersion, error)
func (*Storage) GetFileVersion ¶
func (s *Storage) GetFileVersion(fileID int, version int) (FileVersion, error)
func (*Storage) GetFileVersions ¶
func (s *Storage) GetFileVersions(fileID int) ([]FileVersion, error)
func (*Storage) GetLastFileVersion ¶
func (s *Storage) GetLastFileVersion(fileID int) (FileVersion, error)
func (*Storage) RenameFile ¶
func (*Storage) RestoreFileToVersion ¶
func (*Storage) SaveNewUser ¶
func (*Storage) UpdateFileMetadata ¶
type User ¶
type User struct {
UserID int `db:"id" json:"id"`
Username string `db:"username" json:"username"`
Email string `db:"email" json:"email"`
Password string `db:"password" json:"password"`
Protocol string `db:"hashprotocol" json:"hashprotocol"`
Admin int `db:"admin" json:"admin"`
}
func ConvertUserFromTypes ¶
Click to show internal directories.
Click to hide internal directories.