github.com/cayleygraph/cayley@v0.7.7/quad/value.go (about)

     1  package quad
     2  
     3  import (
     4  	"github.com/cayleygraph/quad"
     5  )
     6  
     7  func IsValidValue(v Value) bool {
     8  	return quad.IsValidValue(v)
     9  }
    10  
    11  // Value is a type used by all quad directions.
    12  //
    13  // Deprecated: use github.com/cayleygraph/quad package instead.
    14  type Value = quad.Value
    15  
    16  type TypedStringer interface {
    17  	TypedString() TypedString
    18  }
    19  
    20  // Equaler interface is implemented by values, that needs a special equality check.
    21  //
    22  // Deprecated: use github.com/cayleygraph/quad package instead.
    23  type Equaler = quad.Value
    24  
    25  // HashSize is a size of the slice, returned by HashOf.
    26  //
    27  // Deprecated: use github.com/cayleygraph/quad package instead.
    28  const HashSize = quad.HashSize
    29  
    30  // HashOf calculates a hash of value v.
    31  //
    32  // Deprecated: use github.com/cayleygraph/quad package instead.
    33  func HashOf(v Value) []byte {
    34  	return quad.HashOf(v)
    35  }
    36  
    37  // HashTo calculates a hash of value v, storing it in a slice p.
    38  //
    39  // Deprecated: use github.com/cayleygraph/quad package instead.
    40  func HashTo(v Value, p []byte) {
    41  	quad.HashTo(v, p)
    42  }
    43  
    44  // StringOf safely call v.String, returning empty string in case of nil Value.
    45  //
    46  // Deprecated: use github.com/cayleygraph/quad package instead.
    47  func StringOf(v Value) string {
    48  	return quad.StringOf(v)
    49  }
    50  
    51  // NativeOf safely call v.Native, returning nil in case of nil Value.
    52  //
    53  // Deprecated: use github.com/cayleygraph/quad package instead.
    54  func NativeOf(v Value) interface{} {
    55  	return quad.NativeOf(v)
    56  }
    57  
    58  // AsValue converts native type into closest Value representation.
    59  // It returns false if type was not recognized.
    60  //
    61  // Deprecated: use github.com/cayleygraph/quad package instead.
    62  func AsValue(v interface{}) (Value, bool) {
    63  	return quad.AsValue(v)
    64  }
    65  
    66  // StringToValue is a function to convert strings to typed
    67  // quad values.
    68  //
    69  // Deprecated: use github.com/cayleygraph/quad package instead.
    70  func StringToValue(v string) Value {
    71  	return quad.StringToValue(v)
    72  }
    73  
    74  // ToString casts a values to String or falls back to StringOf.
    75  //
    76  // Deprecated: use github.com/cayleygraph/quad package instead.
    77  func ToString(v Value) string {
    78  	return quad.ToString(v)
    79  }
    80  
    81  // Raw is a Turtle/NQuads-encoded value.
    82  //
    83  // Deprecated: use IRI or String instead.
    84  func Raw(s string) Value {
    85  	return quad.Raw(s)
    86  }
    87  
    88  // String is an RDF string value (ex: "name").
    89  //
    90  // Deprecated: use github.com/cayleygraph/quad package instead.
    91  type String = quad.String
    92  
    93  // TypedString is an RDF value with type (ex: "name"^^<type>).
    94  //
    95  // Deprecated: use github.com/cayleygraph/quad package instead.
    96  type TypedString = quad.TypedString
    97  
    98  // LangString is an RDF string with language (ex: "name"@lang).
    99  //
   100  // Deprecated: use github.com/cayleygraph/quad package instead.
   101  type LangString = quad.LangString
   102  
   103  // IRIFormat is a format of IRI.
   104  //
   105  // Deprecated: use github.com/cayleygraph/quad package instead.
   106  type IRIFormat = quad.IRIFormat
   107  
   108  const (
   109  	// IRIDefault preserves current IRI formatting.
   110  	IRIDefault = quad.IRIDefault
   111  	// IRIShort changes IRI to use a short namespace prefix (ex: <rdf:type>).
   112  	IRIShort = quad.IRIShort
   113  	// IRIFull changes IRI to use full form (ex: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>).
   114  	IRIFull = quad.IRIFull
   115  )
   116  
   117  // IRI is an RDF Internationalized Resource Identifier (ex: <name>).
   118  //
   119  // Deprecated: use github.com/cayleygraph/quad package instead.
   120  type IRI = quad.IRI
   121  
   122  // BNode is an RDF Blank Node (ex: _:name).
   123  //
   124  // Deprecated: use github.com/cayleygraph/quad package instead.
   125  type BNode = quad.BNode
   126  
   127  // StringConversion is a function to convert string values with a
   128  // specific IRI type to their native equivalents.
   129  //
   130  // Deprecated: use github.com/cayleygraph/quad package instead.
   131  type StringConversion = quad.StringConversion
   132  
   133  // RegisterStringConversion will register an automatic conversion of
   134  // TypedString values with provided type to a native equivalent such as Int, Time, etc.
   135  //
   136  // If fnc is nil, automatic conversion from selected type will be removed.
   137  //
   138  // Deprecated: use github.com/cayleygraph/quad package instead.
   139  func RegisterStringConversion(dataType IRI, fnc StringConversion) {
   140  	quad.RegisterStringConversion(dataType, fnc)
   141  }
   142  
   143  // Int is a native wrapper for int64 type.
   144  //
   145  // It uses NQuad notation similar to TypedString.
   146  //
   147  // Deprecated: use github.com/cayleygraph/quad package instead.
   148  type Int = quad.Int
   149  
   150  // Float is a native wrapper for float64 type.
   151  //
   152  // It uses NQuad notation similar to TypedString.
   153  //
   154  // Deprecated: use github.com/cayleygraph/quad package instead.
   155  type Float = quad.Float
   156  
   157  // Bool is a native wrapper for bool type.
   158  //
   159  // It uses NQuad notation similar to TypedString.
   160  //
   161  // Deprecated: use github.com/cayleygraph/quad package instead.
   162  type Bool = quad.Bool
   163  
   164  // Time is a native wrapper for time.Time type.
   165  //
   166  // It uses NQuad notation similar to TypedString.
   167  //
   168  // Deprecated: use github.com/cayleygraph/quad package instead.
   169  type Time = quad.Time
   170  
   171  type ByValueString = quad.ByValueString
   172  
   173  // Sequence is an object to generate a sequence of Blank Nodes.
   174  //
   175  // Deprecated: use github.com/cayleygraph/quad package instead.
   176  type Sequence = quad.Sequence
   177  
   178  // RandomBlankNode returns a randomly generated Blank Node.
   179  //
   180  // Deprecated: use github.com/cayleygraph/quad package instead.
   181  func RandomBlankNode() BNode {
   182  	return quad.RandomBlankNode()
   183  }