Versions in this module Expand all Collapse all v0 v0.0.4 Mar 25, 2020 Changes in this version + const AuthId + const AuthRedirectAddr + const AuthRouter + const AuthScope + const AuthSecret + const B + const DriveItemPreviewUrl + const DriveItemThumbnailsContentUrl + const DriveItemThumbnailsUrl + const DriveItemsTimeFormat + const DrivePathChildrenUrl + const DrivePathUrl + const EB + const GB + const GetAuthCodeUrl + const GetOrRefreshAccessToken + const GraphUrl + const KB + const KeyDirectoryPrefix + const KeyFilePrefix + const LocationShanghaiKey + const MB + const MethodGET + const MethodPOST + const PB + const TB + const TimeToFormat + var DirectoryBucketName = AssembleDirectoryBucketName + var FileBucketName = zbolt.StringToBytes(KeyFilePrefix) + var LocationShanghai = time.LoadLocation(LocationShanghaiKey) + func AssembleDirectoryBucketName(id []byte) []byte + func AssembleDirectoryFilePath(directory, name string) string + func AssembleListPath(path string) string + func AssembleRouterDirectoryFilePath(router, directory, name string) string + func AssembleUrl(reqUrl string, data map[string]string) string + func FormatSize(size uint64) string + func GetFreePort() (int, error) + func HttpRequestAuth(reqUrl, method string, data, headers map[string]string) ([]byte, error) + type Auth struct + Ch chan interface{} + ClientID string + ClientSecret string + RedirectUri string + Scope string + Token *Token + func NewAuth(id, secret, scope, redirectAddr, redirectUrl string) *Auth + func (a *Auth) GetAccessTokenWithAuthCode(code string) error + func (a *Auth) GetAuthUrl() string + func (a *Auth) Graph() *Graph + func (a *Auth) HttpAuthRequest(w http.ResponseWriter, r *http.Request) + func (a *Auth) HttpRedirectOneDrive(w http.ResponseWriter, r *http.Request) + func (a *Auth) OpenAuthUrl() + func (a *Auth) RefreshToken() error + func (a *Auth) RunRedirectHttp(addr, router string) *http.Server + func (a *Auth) WithToken(token *Token) *Auth + type Config struct + DownloadTimeout int64 + FileRefreshRate int64 + RootPath string + RootPathModified int64 + Token *Token + TokenRefreshRate int64 + func NewConfig(rootPath string, tokenRefreshRate, fileRefreshRate, downloadTimeout int64, ...) (*Config, error) + func (cfg Config) Config() config.Config + type DB struct + func NewZBolt(path string) (*DB, error) + func (db *DB) DeleteDirectory() + func (db *DB) DeleteFile(path string) error + func (db *DB) GetDirectory(directory string) ([]*DriveFile, error) + func (db *DB) GetFile(path string) (*DriveFile, error) + func (db *DB) UpdateFile(ds []*DriveFile) error + type DriveFile struct + ChildCount uint64 + DownloadUrl string + Id string + MimeType string + ModifiedTime int64 + Name string + Path string + Size uint64 + UpdateTime int64 + func FilterFile(localFile, remoteFile []*DriveFile) (insertFiles, updateFiles, deleteFiles []*DriveFile) + func ParseToDriveFile(b []byte) (*DriveFile, error) + func SortDriveFile(driveFiles []*DriveFile) (files, folders []*DriveFile) + func (d *DriveFile) HandleRootPath(rootPath string) *DriveFile + func (d *DriveFile) ToBytes() []byte + type DriveFiles []*DriveFile + func (ds DriveFiles) HandleRootPath(rootPath string) DriveFiles + type DriveItemPreviewResp struct + GetUrl string + type DrivePathChildren struct + DrivePaths []*DriveFile + NextLink string + type DrivePathChildrenResp struct + DrivePathResps []DrivePathResp + NextLink string + func (d *DrivePathChildrenResp) Folders() []string + func (d DrivePathChildrenResp) ToDrivePathChildren() *DrivePathChildren + type DrivePathResp struct + DownloadUrl string + File *File + Folder *Folder + Id string + LastModifiedDateTime string + Name string + ParentReference ParentReference + Size uint64 + func (d *DrivePathResp) ChildCount() uint64 + func (d *DrivePathResp) FormatTime(formatLocation, timeFromFormat string) int64 + func (d *DrivePathResp) MimeType() string + func (d *DrivePathResp) Path() string + func (d *DrivePathResp) ToDriveFile() *DriveFile + type File struct + MimeType string + type Folder struct + ChildCount uint64 + type Graph struct + AccessToken string + func NewGraph(token string) *Graph + func (g *Graph) GetDriveItemPreview(itemId string) (resp *DriveItemPreviewResp, err error) + func (g *Graph) GetDrivePath(path string) (resp *DrivePathResp, err error) + func (g *Graph) GetDrivePathChildren(path string) (resp *DrivePathChildrenResp, err error) + func (g *Graph) GetDrivePathChildrenNextLink(nextLink string) (resp *DrivePathChildrenResp, err error) + type OneDrive struct + func NewOneDrive(database string, cfg *Config) (*OneDrive, error) + func (od *OneDrive) Cfg() Config + func (od *OneDrive) CheckUpdate(path string) (bool, error) + func (od *OneDrive) ClearRepository(path string) error + func (od *OneDrive) GetFile(path string) (driveFile *DriveFile, driveFileChildren, driveFolderChildren []*DriveFile, ...) + func (od *OneDrive) RefreshDownloadUrl(driveFile *DriveFile) error + func (od *OneDrive) RefreshToken() error + func (od *OneDrive) SyncRepository(path string) error + type ParentReference struct + DriveId string + DriveType string + Path string + type Repository interface + DeleteFile func(path string) error + GetDirectory func(directory string) ([]*DriveFile, error) + GetFile func(path string) (*DriveFile, error) + UpdateFile func(ds []*DriveFile) error + type Token struct + AccessToken string + ExpiresIn int64 + ModifiedTime int64 + RefreshToken string + Scope string + TokenType string + func (t *Token) Bytes() []byte + func (t *Token) String() string