spec.go 861 B

1234567891011121314151617181920212223242526272829303132
  1. package sdk
  2. import "github.com/fatih/structs"
  3. type DataContainerDatabaseSpec struct {
  4. TableName string `structs:"table_name"`
  5. Columns []struct {
  6. Name string `structs:"name"`
  7. Type string `structs:"type"`
  8. Comment string `structs:"comment"`
  9. PrimaryKey bool `structs:"primary_key"`
  10. Size int `structs:"size"`
  11. Unique bool `structs:"unique"`
  12. NotNull bool `structs:"not_null"`
  13. Index bool `structs:"index"`
  14. UniqueIndex string `structs:"unique_index"`
  15. Default any `structs:"default"`
  16. } `structs:"columns"`
  17. }
  18. func (spec *DataContainerDatabaseSpec) ToMap() map[string]any {
  19. return structs.Map(spec)
  20. }
  21. type SqlSpec struct {
  22. Transaction bool `structs:"transaction"`
  23. Clauses string `structs:"clauses"`
  24. }
  25. func (spec *SqlSpec) ToMap() map[string]any {
  26. return structs.Map(spec)
  27. }