You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

leveldb.go 580B

123456789101112131415161718192021222324
  1. // Copyright 2020 The Gitea Authors. All rights reserved.
  2. // SPDX-License-Identifier: MIT
  3. package nosql
  4. import "net/url"
  5. // ToLevelDBURI converts old style connections to a LevelDBURI
  6. //
  7. // A LevelDBURI matches the pattern:
  8. //
  9. // leveldb://path[?[option=value]*]
  10. //
  11. // We have previously just provided the path but this prevent other options
  12. func ToLevelDBURI(connection string) *url.URL {
  13. uri, err := url.Parse(connection)
  14. if err == nil && uri.Scheme == "leveldb" {
  15. return uri
  16. }
  17. uri, _ = url.Parse("leveldb://common")
  18. uri.Host = ""
  19. uri.Path = connection
  20. return uri
  21. }