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 652B

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