{"modulePath":"github.com/RedAFD/code-core","version":"v1.8.3","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package uploader\n\n## Functions\n\n```go\nfunc DeleteRepoFile(repo *models.Repository, doer *models.User, opts *DeleteRepoFileOptions) error\n```\nDeleteRepoFile deletes a file in the given repository\n\n```go\nfunc GetDiffPreview(repo *models.Repository, branch, treePath, content string) (*models.Diff, error)\n```\nGetDiffPreview produces and returns diff result of a file which is not yet committed.\n\n```go\nfunc UpdateRepoFile(repo *models.Repository, doer *models.User, opts *UpdateRepoFileOptions) error\n```\nUpdateRepoFile adds or updates a file in the given repository\n\n```go\nfunc UploadRepoFiles(repo *models.Repository, doer *models.User, opts *UploadRepoFileOptions) error\n```\nUploadRepoFiles uploads files to the given repository\n\n## Types\n\n```go\ntype DeleteRepoFileOptions struct {\n\tLastCommitID string\n\tOldBranch    string\n\tNewBranch    string\n\tTreePath     string\n\tMessage      string\n}\n```\nDeleteRepoFileOptions holds the repository delete file options\n\n```go\ntype TemporaryUploadRepository struct {\n\t// contains filtered or unexported fields\n}\n```\nTemporaryUploadRepository is a type to wrap our upload repositories\n\n```go\nfunc NewTemporaryUploadRepository(repo *models.Repository) (*TemporaryUploadRepository, error)\n```\nNewTemporaryUploadRepository creates a new temporary upload repository\n\n```go\nfunc (t *TemporaryUploadRepository) AddObjectToIndex(mode, objectHash, objectPath string) error\n```\nAddObjectToIndex adds the provided object hash to the index with the provided mode and path\n\n```go\nfunc (t *TemporaryUploadRepository) CheckAttribute(attribute string, args ...string) (map[string]map[string]string, error)\n```\nCheckAttribute checks the given attribute of the provided files\n\n```go\nfunc (t *TemporaryUploadRepository) Clone(branch string) error\n```\nClone the base repository to our path and set branch as the HEAD\n\n```go\nfunc (t *TemporaryUploadRepository) Close()\n```\nClose the repository cleaning up all files\n\n```go\nfunc (t *TemporaryUploadRepository) CommitTree(doer *models.User, treeHash string, message string) (string, error)\n```\nCommitTree creates a commit from a given tree for the user with provided message\n\n```go\nfunc (t *TemporaryUploadRepository) DiffIndex() (diff *models.Diff, err error)\n```\nDiffIndex returns a Diff of the current index to the head\n\n```go\nfunc (t *TemporaryUploadRepository) HashObject(content io.Reader) (string, error)\n```\nHashObject writes the provided content to the object db and returns its hash\n\n```go\nfunc (t *TemporaryUploadRepository) LsFiles(filenames ...string) ([]string, error)\n```\nLsFiles checks if the given filename arguments are in the index\n\n```go\nfunc (t *TemporaryUploadRepository) Push(doer *models.User, commitHash string, branch string) error\n```\nPush the provided commitHash to the repository branch by the provided user\n\n```go\nfunc (t *TemporaryUploadRepository) RemoveFilesFromIndex(filenames ...string) error\n```\nRemoveFilesFromIndex removes the given files from the index\n\n```go\nfunc (t *TemporaryUploadRepository) SetDefaultIndex() error\n```\nSetDefaultIndex sets the git index to our HEAD\n\n```go\nfunc (t *TemporaryUploadRepository) WriteTree() (string, error)\n```\nWriteTree writes the current index as a tree to the object db and returns its hash\n\n```go\ntype UpdateRepoFileOptions struct {\n\tLastCommitID string\n\tOldBranch    string\n\tNewBranch    string\n\tOldTreeName  string\n\tNewTreeName  string\n\tMessage      string\n\tContent      string\n\tIsNewFile    bool\n}\n```\nUpdateRepoFileOptions holds the repository file update options\n\n```go\ntype UploadRepoFileOptions struct {\n\tLastCommitID string\n\tOldBranch    string\n\tNewBranch    string\n\tTreePath     string\n\tMessage      string\n\tFiles        []string // In UUID format.\n}\n```\nUploadRepoFileOptions contains the uploaded repository file options\n\n","path":"github.com/RedAFD/code-core/modules/uploader","name":"uploader","synopsis":"","isRedistributable":true}
