2023-01-28 21:57:53 +00:00
|
|
|
package unstable
|
2022-04-25 21:50:10 +00:00
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
|
2023-01-28 21:57:53 +00:00
|
|
|
// Kind represents the type of TOML structure contained in a given Node.
|
2022-04-25 21:50:10 +00:00
|
|
|
type Kind int
|
|
|
|
|
|
|
|
const (
|
2023-01-28 21:57:53 +00:00
|
|
|
// Meta
|
2022-04-25 21:50:10 +00:00
|
|
|
Invalid Kind = iota
|
|
|
|
Comment
|
|
|
|
Key
|
|
|
|
|
2023-01-28 21:57:53 +00:00
|
|
|
// Top level structures
|
2022-04-25 21:50:10 +00:00
|
|
|
Table
|
|
|
|
ArrayTable
|
|
|
|
KeyValue
|
|
|
|
|
2023-01-28 21:57:53 +00:00
|
|
|
// Containers values
|
2022-04-25 21:50:10 +00:00
|
|
|
Array
|
|
|
|
InlineTable
|
|
|
|
|
2023-01-28 21:57:53 +00:00
|
|
|
// Values
|
2022-04-25 21:50:10 +00:00
|
|
|
String
|
|
|
|
Bool
|
|
|
|
Float
|
|
|
|
Integer
|
|
|
|
LocalDate
|
|
|
|
LocalTime
|
|
|
|
LocalDateTime
|
|
|
|
DateTime
|
|
|
|
)
|
|
|
|
|
2023-01-28 21:57:53 +00:00
|
|
|
// String implementation of fmt.Stringer.
|
2022-04-25 21:50:10 +00:00
|
|
|
func (k Kind) String() string {
|
|
|
|
switch k {
|
|
|
|
case Invalid:
|
|
|
|
return "Invalid"
|
|
|
|
case Comment:
|
|
|
|
return "Comment"
|
|
|
|
case Key:
|
|
|
|
return "Key"
|
|
|
|
case Table:
|
|
|
|
return "Table"
|
|
|
|
case ArrayTable:
|
|
|
|
return "ArrayTable"
|
|
|
|
case KeyValue:
|
|
|
|
return "KeyValue"
|
|
|
|
case Array:
|
|
|
|
return "Array"
|
|
|
|
case InlineTable:
|
|
|
|
return "InlineTable"
|
|
|
|
case String:
|
|
|
|
return "String"
|
|
|
|
case Bool:
|
|
|
|
return "Bool"
|
|
|
|
case Float:
|
|
|
|
return "Float"
|
|
|
|
case Integer:
|
|
|
|
return "Integer"
|
|
|
|
case LocalDate:
|
|
|
|
return "LocalDate"
|
|
|
|
case LocalTime:
|
|
|
|
return "LocalTime"
|
|
|
|
case LocalDateTime:
|
|
|
|
return "LocalDateTime"
|
|
|
|
case DateTime:
|
|
|
|
return "DateTime"
|
|
|
|
}
|
|
|
|
panic(fmt.Errorf("Kind.String() not implemented for '%d'", k))
|
|
|
|
}
|