Skip to content

Commit

Permalink
code gen is working
Browse files Browse the repository at this point in the history
  • Loading branch information
omerdemirok committed Nov 11, 2023
1 parent 7239728 commit 2268887
Show file tree
Hide file tree
Showing 277 changed files with 11,706 additions and 17 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ help: ## Display help

.PHONY: generate-core-code
generate-core-code:
go run xata/internal/core_code_gen.go -scope=core
go run xata/internal/code_gen.go -scope=core

.PHONY: generate-workspace-code
generate-workspace-code:
go run xata/internal/core_code_gen.go -scope=workspace
go run xata/internal/code_gen.go -scope=workspace
4 changes: 3 additions & 1 deletion xata/branch_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ type BranchRequest struct {
BranchName string
}

type BranchMetadataWS xatagenworkspace.BranchMetadata

type CreateBranchRequestPayload struct {
CreateBranchRequestFrom *string
Metadata *BranchMetadata
Metadata *BranchMetadataWS
}

type CreateBranchRequest struct {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// SPDX-License-Identifier: Apache-2.0

// This file was auto-generated by Fern from our API Definition.

package api

type BulkInsertTableRecordsResponse map[string][]map[string]interface{}
121 changes: 121 additions & 0 deletions xata/internal/code-gen-utils/column_type.go_
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
// SPDX-License-Identifier: Apache-2.0

// This file was auto-generated by Fern from our API Definition.

package api

import (
json "encoding/json"
fmt "fmt"
strconv "strconv"
)

type ColumnType uint8

const (
ColumnTypeBool ColumnType = iota + 1
ColumnTypeInt
ColumnTypeFloat
ColumnTypeString
ColumnTypeText
ColumnTypeEmail
ColumnTypeMultiple
ColumnTypeLink
ColumnTypeObject
ColumnTypeDatetime
ColumnTypeVector
ColumnTypeFile
ColumnTypeFileMap
ColumnTypeJson
)

func (c ColumnType) String() string {
switch c {
default:
return strconv.Itoa(int(c))
case ColumnTypeBool:
return "bool"
case ColumnTypeInt:
return "int"
case ColumnTypeFloat:
return "float"
case ColumnTypeString:
return "string"
case ColumnTypeText:
return "text"
case ColumnTypeEmail:
return "email"
case ColumnTypeMultiple:
return "multiple"
case ColumnTypeLink:
return "link"
case ColumnTypeObject:
return "object"
case ColumnTypeDatetime:
return "datetime"
case ColumnTypeVector:
return "vector"
case ColumnTypeFile:
return "file"
case ColumnTypeFileMap:
return "file[]"
case ColumnTypeJson:
return "json"
}
}

func (c ColumnType) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf("%q", c.String())), nil
}

func (c *ColumnType) UnmarshalJSON(data []byte) error {
var raw string
if err := json.Unmarshal(data, &raw); err != nil {
return err
}
switch raw {
case "bool":
value := ColumnTypeBool
*c = value
case "int":
value := ColumnTypeInt
*c = value
case "float":
value := ColumnTypeFloat
*c = value
case "string":
value := ColumnTypeString
*c = value
case "text":
value := ColumnTypeText
*c = value
case "email":
value := ColumnTypeEmail
*c = value
case "multiple":
value := ColumnTypeMultiple
*c = value
case "link":
value := ColumnTypeLink
*c = value
case "object":
value := ColumnTypeObject
*c = value
case "datetime":
value := ColumnTypeDatetime
*c = value
case "vector":
value := ColumnTypeVector
*c = value
case "file":
value := ColumnTypeFile
*c = value
case "fileMap":
value := ColumnTypeFileMap
*c = value
case "json":
value := ColumnTypeJson
*c = value
}
return nil
}
Loading

0 comments on commit 2268887

Please sign in to comment.