result.go 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * EliasDB
  3. *
  4. * Copyright 2016 Matthias Ladkau. All rights reserved.
  5. *
  6. * This Source Code Form is subject to the terms of the Mozilla Public
  7. * License, v. 2.0. If a copy of the MPL was not distributed with this
  8. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  9. */
  10. package eql
  11. /*
  12. SearchResultHeader models the header of an EQL search result.
  13. */
  14. type SearchResultHeader interface {
  15. /*
  16. Partition returns the partition of a search result.
  17. */
  18. Partition() string
  19. /*
  20. PrimaryKind returns the primary kind of a search result.
  21. */
  22. PrimaryKind() string
  23. /*
  24. Labels returns all column labels of a search result.
  25. */
  26. Labels() []string
  27. /*
  28. Format returns all column format definitions of a search result.
  29. */
  30. Format() []string
  31. /*
  32. Data returns the data which is displayed in each column of a search result.
  33. (e.g. 1:n:name - Name of starting nodes,
  34. 3:e:key - Key of edge traversed in the second traversal)
  35. */
  36. Data() []string
  37. }
  38. /*
  39. SearchResult models an EQL search result.
  40. */
  41. type SearchResult interface {
  42. /*
  43. Header returns a data structure describing the result header.
  44. */
  45. Header() SearchResultHeader
  46. /*
  47. Query returns the query which produced this result.
  48. */
  49. Query() string
  50. /*
  51. RowCount returns the number of rows of the result.
  52. */
  53. RowCount() int
  54. /*
  55. Row returns a row of the result.
  56. */
  57. Row(line int) []interface{}
  58. /*
  59. Rows returns all result rows.
  60. */
  61. Rows() [][]interface{}
  62. /*
  63. RowSource returns the sources of a result row.
  64. Format is either: <n/e>:<kind>:<key> or q:<query>
  65. */
  66. RowSource(line int) []string
  67. /*
  68. RowSources returns the sources of a result.
  69. */
  70. RowSources() [][]string
  71. /*
  72. String returns a string representation of this search result.
  73. */
  74. String() string
  75. /*
  76. CSV returns this search result as comma-separated strings.
  77. */
  78. CSV() string
  79. }