Add trap count data to source page
It's...way too many rows, now that I have the actual data. It needs to be reworked.
This commit is contained in:
parent
26ee3efcc8
commit
e7ece52c8c
32 changed files with 1622 additions and 298 deletions
|
|
@ -10,6 +10,7 @@ import (
|
|||
|
||||
enums "github.com/Gleipnir-Technology/nidus-sync/enums"
|
||||
"github.com/jaswdr/faker/v2"
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/stephenafamo/bob"
|
||||
pg_query "github.com/wasilibs/go-pgquery"
|
||||
)
|
||||
|
|
@ -28,6 +29,37 @@ func formatQuery(s string) (string, error) {
|
|||
|
||||
var defaultFaker = faker.New()
|
||||
|
||||
func random_decimal_Decimal(f *faker.Faker, limits ...string) decimal.Decimal {
|
||||
if f == nil {
|
||||
f = &defaultFaker
|
||||
}
|
||||
|
||||
var precision int64 = 7
|
||||
var scale int64 = 3
|
||||
|
||||
if len(limits) > 0 {
|
||||
precision, _ = strconv.ParseInt(limits[0], 10, 32)
|
||||
}
|
||||
|
||||
if len(limits) > 1 {
|
||||
scale, _ = strconv.ParseInt(limits[1], 10, 32)
|
||||
}
|
||||
|
||||
baseVal := f.Float32(10, -1, 1)
|
||||
for baseVal == -1 || baseVal == 0 || baseVal == 1 {
|
||||
baseVal = f.Float32(10, -1, 1)
|
||||
}
|
||||
|
||||
precisionDecimal, _ := decimal.NewFromInt(10).PowInt32(int32(precision))
|
||||
val := decimal.
|
||||
NewFromFloat32(baseVal).
|
||||
Mul(precisionDecimal).
|
||||
Shift(int32(-1 * scale)).
|
||||
RoundDown(int32(scale))
|
||||
|
||||
return val
|
||||
}
|
||||
|
||||
func random_enums_Arcgislicensetype(f *faker.Faker, limits ...string) enums.Arcgislicensetype {
|
||||
if f == nil {
|
||||
f = &defaultFaker
|
||||
|
|
@ -56,6 +88,14 @@ func random_int32(f *faker.Faker, limits ...string) int32 {
|
|||
return f.Int32()
|
||||
}
|
||||
|
||||
func random_int64(f *faker.Faker, limits ...string) int64 {
|
||||
if f == nil {
|
||||
f = &defaultFaker
|
||||
}
|
||||
|
||||
return f.Int64()
|
||||
}
|
||||
|
||||
func random_string(f *faker.Faker, limits ...string) string {
|
||||
if f == nil {
|
||||
f = &defaultFaker
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue