How to get Realm from HCL files #1431
Answered
by
rotemtam
stephenafamo
asked this question in
Q&A
-
I am trying to directly generate Bob models from the schema defined in the HCL files. To do that, I am trying to marshal a Here is where I'm at: table "users" {
schema = schema.example
column "id" {
null = false
type = int
}
column "name" {
null = true
type = varchar(100)
}
primary_key {
columns = [column.id]
}
} parser, err := parseHCLPaths("path/to/directory") // copied this function from atlas
if err != nil {
return nil, err
}
client := schemahcl.New()
realm := &schema.Realm{}
if err := client.Eval(parser, realm, nil); err != nil {
return nil, err
} However, this fails with various errors such as:
And if I comment out the schema line
|
Beta Was this translation helpful? Give feedback.
Answered by
rotemtam
Jan 27, 2023
Replies: 1 comment 1 reply
-
schemahcl is a fairly low level library. each driver has a method for reading HCL, for example: Line 93 in 25fc911 |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
stephenafamo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
schemahcl is a fairly low level library. each driver has a method for reading HCL, for example:
atlas/sql/mysql/sqlspec.go
Line 93 in 25fc911