gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

kind.go (1071B)


      1 package unstable
      2 
      3 import "fmt"
      4 
      5 // Kind represents the type of TOML structure contained in a given Node.
      6 type Kind int
      7 
      8 const (
      9 	// Meta
     10 	Invalid Kind = iota
     11 	Comment
     12 	Key
     13 
     14 	// Top level structures
     15 	Table
     16 	ArrayTable
     17 	KeyValue
     18 
     19 	// Containers values
     20 	Array
     21 	InlineTable
     22 
     23 	// Values
     24 	String
     25 	Bool
     26 	Float
     27 	Integer
     28 	LocalDate
     29 	LocalTime
     30 	LocalDateTime
     31 	DateTime
     32 )
     33 
     34 // String implementation of fmt.Stringer.
     35 func (k Kind) String() string {
     36 	switch k {
     37 	case Invalid:
     38 		return "Invalid"
     39 	case Comment:
     40 		return "Comment"
     41 	case Key:
     42 		return "Key"
     43 	case Table:
     44 		return "Table"
     45 	case ArrayTable:
     46 		return "ArrayTable"
     47 	case KeyValue:
     48 		return "KeyValue"
     49 	case Array:
     50 		return "Array"
     51 	case InlineTable:
     52 		return "InlineTable"
     53 	case String:
     54 		return "String"
     55 	case Bool:
     56 		return "Bool"
     57 	case Float:
     58 		return "Float"
     59 	case Integer:
     60 		return "Integer"
     61 	case LocalDate:
     62 		return "LocalDate"
     63 	case LocalTime:
     64 		return "LocalTime"
     65 	case LocalDateTime:
     66 		return "LocalDateTime"
     67 	case DateTime:
     68 		return "DateTime"
     69 	}
     70 	panic(fmt.Errorf("Kind.String() not implemented for '%d'", k))
     71 }