• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

cty/H23-Feb-2021-33,21326,846

docs/H23-Feb-2021-1,292991

.travis.shH A D23-Feb-2021257 139

.travis.ymlH A D23-Feb-2021174 1611

CHANGELOG.mdH A D23-Feb-202115.4 KiB140102

LICENSEH A D23-Feb-20211 KiB2217

README.mdH A D23-Feb-20213.1 KiB6751

go.modH A D23-Feb-2021207 118

go.sumH A D23-Feb-20212.8 KiB3231

README.md

1# cty
2
3`cty` (pronounced "see-tie") is a dynamic type system for applications written
4in Go that need to represent user-supplied values without losing type
5information. The primary intended use is for implementing configuration
6languages, but other uses may be possible too.
7
8One could think of `cty` as being the reflection API for a language that
9doesn't exist, or that doesn't exist _yet_. It provides a set of value types
10and an API for working with values of that type.
11
12Fundamentally what `cty` provides is equivalent to an `interface{}` with some
13dynamic type information attached, but `cty` encapsulates this to ensure that
14invariants are preserved and to provide a more convenient API.
15
16As well as primitive types, basic collection types (lists, maps and sets) and
17structural types (object, tuple), the `cty` type and value system has some
18additional, optional features that may be useful to certain applications:
19
20* Representation of "unknown" values, which serve as a typed placeholder for
21  a value that has yet to be determined. This can be a useful building-block
22  for a type checker. Unknown values support all of the same operations as
23  known values of their type, but the result will often itself be unknown.
24
25* Representation of values whose _types_ aren't even known yet. This can
26  represent, for example, the result of a JSON-decoding function before the
27  JSON data is known.
28
29Along with the type system itself, a number of utility packages are provided
30that build on the basics to help integrate `cty` into calling applications.
31For example, `cty` values can be automatically converted to other types,
32converted to and from native Go data structures, or serialized as JSON.
33
34For more details, see the following documentation:
35
36* [Concepts](./docs/concepts.md)
37* [Full Description of the `cty` Types](./docs/types.md)
38* [API Reference](https://godoc.org/github.com/zclconf/go-cty/cty) (godoc)
39* [Conversion between `cty` types](./docs/convert.md)
40* [Conversion to and from native Go values](./docs/gocty.md)
41* [JSON serialization](./docs/json.md)
42* [`cty` Functions system](./docs/functions.md)
43
44---
45
46## License
47
48Copyright 2017 Martin Atkins
49
50Permission is hereby granted, free of charge, to any person obtaining a copy
51of this software and associated documentation files (the "Software"), to deal
52in the Software without restriction, including without limitation the rights
53to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
54copies of the Software, and to permit persons to whom the Software is
55furnished to do so, subject to the following conditions:
56
57The above copyright notice and this permission notice shall be included in all
58copies or substantial portions of the Software.
59
60THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
61IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
62FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
63AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
64LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
65OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
66SOFTWARE.
67