This commit is contained in:
Chris Lu 2021-01-14 23:11:27 -08:00
parent f002e668de
commit 16ad74f477
5 changed files with 7 additions and 7 deletions

View file

@ -203,7 +203,7 @@ func (store *AbstractSqlStore) ListDirectoryPrefixedEntries(ctx context.Context,
entries = append(entries, entry)
}
hasMore = int64(len(entries)) == limit + 1
hasMore = int64(len(entries)) == limit+1
if hasMore {
entries = entries[:limit]
}

View file

@ -201,7 +201,7 @@ func (store *CassandraStore) ListDirectoryEntries(ctx context.Context, dirPath u
glog.V(0).Infof("list iterator close: %v", err)
}
hasMore = int64(len(entries)) == limit + 1
hasMore = int64(len(entries)) == limit+1
if hasMore {
entries = entries[:limit]
}

View file

@ -53,7 +53,7 @@ func (f *Filer) doListPatternMatchedEntries(ctx context.Context, p util.FullPath
return
}
if len(restNamePattern) == 0 {
return foundEntries, false,0, lastFileName, nil
return foundEntries, false, 0, lastFileName, nil
}
for _, entry := range foundEntries {
nameToTest := strings.ToLower(entry.Name())

View file

@ -190,7 +190,7 @@ func (store *MongodbStore) ListDirectoryEntries(ctx context.Context, dirPath uti
"$gte": startFileName,
}
}
optLimit := int64(limit+1)
optLimit := int64(limit + 1)
opts := &options.FindOptions{Limit: &optLimit, Sort: bson.M{"name": 1}}
cur, err := store.connect.Database(store.database).Collection(store.collectionName).Find(ctx, where, opts)
for cur.Next(ctx) {
@ -212,7 +212,7 @@ func (store *MongodbStore) ListDirectoryEntries(ctx context.Context, dirPath uti
entries = append(entries, entry)
}
hasMore = int64(len(entries)) == limit + 1
hasMore = int64(len(entries)) == limit+1
if hasMore {
entries = entries[:limit]
}

View file

@ -42,7 +42,7 @@ func (store *MysqlStore) Initialize(configuration util.Configuration, prefix str
}
func (store *MysqlStore) initialize(user, password, hostname string, port int, database string, maxIdle, maxOpen,
maxLifetimeSeconds int, interpolateParams bool) (err error) {
maxLifetimeSeconds int, interpolateParams bool) (err error) {
//
store.SqlInsert = "INSERT INTO filemeta (dirhash,name,directory,meta) VALUES(?,?,?,?)"
store.SqlUpdate = "UPDATE filemeta SET meta=? WHERE dirhash=? AND name=? AND directory=?"
@ -67,7 +67,7 @@ func (store *MysqlStore) initialize(user, password, hostname string, port int, d
store.DB.SetMaxIdleConns(maxIdle)
store.DB.SetMaxOpenConns(maxOpen)
store.DB.SetConnMaxLifetime(time.Duration(maxLifetimeSeconds)*time.Second)
store.DB.SetConnMaxLifetime(time.Duration(maxLifetimeSeconds) * time.Second)
if err = store.DB.Ping(); err != nil {
return fmt.Errorf("connect to %s error:%v", sqlUrl, err)