-
Notifications
You must be signed in to change notification settings - Fork 622
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
37030fb
commit e14dad0
Showing
13 changed files
with
1,013 additions
and
981 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package internal | ||
|
||
type UnsetColumn struct{} | ||
|
||
func ReadInt(p []byte) int32 { | ||
return int32(p[0])<<24 | int32(p[1])<<16 | int32(p[2])<<8 | int32(p[3]) | ||
} | ||
|
||
func AppendBytes(p []byte, d []byte) []byte { | ||
if d == nil { | ||
return AppendInt(p, -1) | ||
} | ||
p = AppendInt(p, int32(len(d))) | ||
p = append(p, d...) | ||
return p | ||
} | ||
|
||
func AppendShort(p []byte, n uint16) []byte { | ||
return append(p, | ||
byte(n>>8), | ||
byte(n), | ||
) | ||
} | ||
|
||
func AppendInt(p []byte, n int32) []byte { | ||
return append(p, byte(n>>24), | ||
byte(n>>16), | ||
byte(n>>8), | ||
byte(n)) | ||
} | ||
|
||
func AppendUint(p []byte, n uint32) []byte { | ||
return append(p, byte(n>>24), | ||
byte(n>>16), | ||
byte(n>>8), | ||
byte(n)) | ||
} | ||
|
||
func AppendLong(p []byte, n int64) []byte { | ||
return append(p, | ||
byte(n>>56), | ||
byte(n>>48), | ||
byte(n>>40), | ||
byte(n>>32), | ||
byte(n>>24), | ||
byte(n>>16), | ||
byte(n>>8), | ||
byte(n), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package internal | ||
|
||
import "strings" | ||
|
||
func SplitCompositeTypes(name string) []string { | ||
if !strings.Contains(name, "<") { | ||
return strings.Split(name, ", ") | ||
} | ||
var parts []string | ||
lessCount := 0 | ||
segment := "" | ||
for _, char := range name { | ||
if char == ',' && lessCount == 0 { | ||
if segment != "" { | ||
parts = append(parts, strings.TrimSpace(segment)) | ||
} | ||
segment = "" | ||
continue | ||
} | ||
segment += string(char) | ||
if char == '<' { | ||
lessCount++ | ||
} else if char == '>' { | ||
lessCount-- | ||
} | ||
} | ||
if segment != "" { | ||
parts = append(parts, strings.TrimSpace(segment)) | ||
} | ||
return parts | ||
} | ||
|
||
func CopyBytes(p []byte) []byte { | ||
b := make([]byte, len(p)) | ||
copy(b, p) | ||
return b | ||
} |
Oops, something went wrong.