a631807682 / issues-translator

GitHub Action for translate issues to English
MIT License
1 stars 0 forks source link

translation selection #17

Closed a631807682 closed 2 years ago

a631807682 commented 2 years ago

Describe the bug 不翻译注释和代码

//连接数据库gorm.io/gorm
db, err := gorm.Open(mysql.New(mysql.Config{
    DriverName: "mysql",
    DSN:        "root:123456@(127.0.0.1:3306)/gomicro_test?charset=utf8mb4&parseTime=True&loc=Local",
}))
a631807682 commented 2 years ago

Describe the bug 不翻译注释和代码

//连接数据库gorm.io/gorm
db, err := gorm.Open(mysql.New(mysql.Config{
    DriverName: "mysql",
    DSN:        "root:123456@(127.0.0.1:3306)/gomicro_test?charset=utf8mb4&parseTime=True&loc=Local",
}))
a631807682 commented 2 years ago

Describe the bug 不翻译注释和代码

//连接数据库gorm.io/gorm
db, err := gorm.Open(mysql.New(mysql.Config{
    DriverName: "mysql",
    DSN:        "root:123456@(127.0.0.1:3306)/gomicro_test?charset=utf8mb4&parseTime=True&loc=Local",
}))
a631807682 commented 2 years ago

Describe the bug 不翻译注释和代码

//连接数据库gorm.io/gorm
db, err := gorm.Open(mysql.New(mysql.Config{
    DriverName: "mysql",
    DSN:        "root:123456@(127.0.0.1:3306)/gomicro_test?charset=utf8mb4&parseTime=True&loc=Local",
}))
a631807682 commented 2 years ago

Describe the bug 不翻译注释和代码

function cleanCode(s) {
  return s.replace(/^\`\`\`(\s|[a-zA-Z]*)\n([\s\S]*?)\`\`\`$/gm, '')
}
a631807682 commented 2 years ago

Describe the bug 不翻译注释和代码

github-actions[bot] commented 2 years ago

Bot detected the issue body's language is not English, translate it automatically.

Describe the bug Comments and code are not translated

a631807682 commented 2 years ago

Describe the bug 不翻译注释和代码

function cleanCode(s) {
  return s.replace(/^\`\`\`(\s|[a-zA-Z]*)\n([\s\S]*?)\`\`\`$/gm, '')
}
a631807682 commented 2 years ago

Describe the bug 不翻译注释和代码

function cleanCode(s) {
  return s.replace(/^\`\`\`(\s|[a-zA-Z]*)\n([\s\S]*?)\`\`\`$/gm, '')
}
a631807682 commented 2 years ago

Describe the bug 不翻译注释和代码

function cleanCode(s) {
  return s.replace(/^\`\`\`(\s|[a-zA-Z]*)\n([\s\S]*?)\`\`\`$/gm, '')
}
github-actions[bot] commented 2 years ago

Bot detected the issue body's language is not English, translate it automatically.

Describe the bug Comments and code are not translated

function cleanCode(s) {
  return s.replace(/^\`\`\`(\s|[a-zA-Z]*)\n([\s\S]*?)\`\`\`$/gm, '' )
}
a631807682 commented 2 years ago

Describe the bug 不翻译注释和代码

//连接数据库gorm.io/gorm
db, err := gorm.Open(mysql.New(mysql.Config{
    DriverName: "mysql",
    DSN:        "root:123456@(127.0.0.1:3306)/gomicro_test?charset=utf8mb4&parseTime=True&loc=Local",
}))
a631807682 commented 2 years ago

Describe the bug 不翻译注释和代码

//连接数据库gorm.io/gorm
db, err := gorm.Open(mysql.New(mysql.Config{
    DriverName: "mysql",
    DSN:        "root:123456@(127.0.0.1:3306)/gomicro_test?charset=utf8mb4&parseTime=True&loc=Local",
}))
a631807682 commented 2 years ago

Describe the bug 不翻译注释和代码

//连接数据库gorm.io/gorm
db, err := gorm.Open(mysql.New(mysql.Config{
    DriverName: "mysql",
    DSN:        "root:123456@(127.0.0.1:3306)/gomicro_test?charset=utf8mb4&parseTime=True&loc=Local",
}))
a631807682 commented 2 years ago

Describe the bug 不翻译注释和代码

//连接数据库gorm.io/gorm
db, err := gorm.Open(mysql.New(mysql.Config{
    DriverName: "mysql",
    DSN:        "root:123456@(127.0.0.1:3306)/gomicro_test?charset=utf8mb4&parseTime=True&loc=Local",
}))
github-actions[bot] commented 2 years ago

Bot detected the issue body's language is not English, translate it automatically.

Describe the bug Comments and code are not translated

//Connect to the database gorm.io/gorm
db, err := gorm.Open(mysql.New(mysql.Config{
DriverName: "mysql",
DSN: "root:123456@(127.0.0.1:3306)/gomicro_test?charset=utf8mb4&parseTime=True&loc=Local",
}))
a631807682 commented 2 years ago

你怎么会有「写在官方库内更好」的想法,不如看看 pg redis fdw

github-actions[bot] commented 2 years ago

Bot detected the issue body's language is not English, translate it automatically.

How can you have the idea of ​​"it's better to write in the official library", why don't you take a look at pg redis fdw

a631807682 commented 2 years ago

我的问题是 用grom 自定义字段,怎么解析mysql 字符串类型的json 数组

type WarehouseCheckGoods struct {
    ID               int64     `gorm:"column:id" db:"column:id" json:"id" form:"id"`
    GoodsId          int64     `gorm:"column:goods_id" db:"column:goods_id" json:"goods_id" form:"goods_id"`
    SkuCode          string    `gorm:"column:sku_code" db:"column:sku_code" json:"sku_code" form:"sku_code"`
    Remarks          string    `gorm:"column:remarks" db:"column:remarks" json:"remarks" form:"remarks"`
    RealNumber       int64     `gorm:"column:real_number" db:"column:real_number" json:"real_number" form:"real_number"`
    BookNumber       int64     `gorm:"column:book_number" db:"column:book_number" json:"book_number" form:"book_number"`
    AdjustNumber     int64     `gorm:"column:adjust_number" db:"column:adjust_number" json:"adjust_number" form:"adjust_number"`
    WarehouseCheckId int64     `gorm:"column:warehouse_check_id" db:"column:warehouse_check_id" json:"warehouse_check_id" form:"warehouse_check_id"`
    ThreeWarehouse   AutoGenerated   `gorm:"column:three_warehouse" db:"column:three_warehouse" json:"three_warehouse" form:"three_warehouse"`
    CreatedAt        time.Time `gorm:"column:created_at" db:"column:created_at" json:"created_at" form:"created_at"`
    UpdatedAt        time.Time `gorm:"column:updated_at" db:"column:updated_at" json:"updated_at" form:"updated_at"`
}

type AutoGenerated []struct {
    WarehouseID  int    `json:"warehouse_id"`
    BookNumber   string `json:"book_number"`
    AdjustNumber string `json:"adjust_number"`
}

func (j *AutoGenerated) Scan(value interface{}) error {
    bytes, _ := value.([]uint8)
    var lins AutoGenerated
    json.Unmarshal([]byte(bytes), &lins)
//打印lins ,输出正常
    j = &lins
// 把值赋给 指针,输出是null
    return nil
}

func (j AutoGenerated) Value() (driver.Value, error) {
    return j, nil
}

其中ThreeWarehouse 这个字段为json 数组格式的字符 格式

[{"warehouse_id":1,"book_number":"0","adjust_number":"15"}]

然后我自定义的类型AutoGenerated,代码如上方,我把json绑定到结构体,打印都正常,但是赋值给指针,后接口请求不正常;哪位大神知道下,我这种怎么处理,谢谢🙏

目前返回的数据格式是

{
        "id": 3,
        "code": "PD1648024354793825",
        "name": "",
        "warehouse_id": 1,
        "state": 1,
        "company_id": 1092,
        "user_id": 1,
        "created_at": "2022-03-23T16:32:34+08:00",
        "updated_at": "2022-03-23T16:54:30+08:00",
        "deleted_at": "2022-03-23T16:54:30+08:00",
        "CheckGoods": [
            {
                "id": 3,
                "goods_id": 1,
                "sku_code": "164802272092095",
                "remarks": "",
                "real_number": 2580,
                "book_number": 3000,
                "adjust_number": -420,
                "warehouse_check_id": 3,
                "three_warehouse": null, 
                "created_at": "2022-03-23T16:32:34+08:00",
                "updated_at": "2022-03-23T16:32:34+08:00"
            }
        ]
    }]
}

可以看出three_warehouse,这个字段返回的是null 我期望的是

{
        "id": 3,
        "code": "PD1648024354793825",
        "name": "",
        "warehouse_id": 1,
        "state": 1,
        "company_id": 1092,
        "user_id": 1,
        "created_at": "2022-03-23T16:32:34+08:00",
        "updated_at": "2022-03-23T16:54:30+08:00",
        "deleted_at": "2022-03-23T16:54:30+08:00",
        "CheckGoods": [
            {
                "id": 3,
                "goods_id": 1,
                "sku_code": "164802272092095",
                "remarks": "",
                "real_number": 2580,
                "book_number": 3000,
                "adjust_number": -420,
                "warehouse_check_id": 3,
a631807682 commented 2 years ago

Describe the bug Comments and code are not translated

a631807682 commented 2 years ago

我的问题是 用grom 自定义字段,怎么解析mysql 字符串类型的json 数组

type WarehouseCheckGoods struct {
    ID               int64     `gorm:"column:id" db:"column:id" json:"id" form:"id"`
    GoodsId          int64     `gorm:"column:goods_id" db:"column:goods_id" json:"goods_id" form:"goods_id"`
    SkuCode          string    `gorm:"column:sku_code" db:"column:sku_code" json:"sku_code" form:"sku_code"`
    Remarks          string    `gorm:"column:remarks" db:"column:remarks" json:"remarks" form:"remarks"`
    RealNumber       int64     `gorm:"column:real_number" db:"column:real_number" json:"real_number" form:"real_number"`
    BookNumber       int64     `gorm:"column:book_number" db:"column:book_number" json:"book_number" form:"book_number"`
    AdjustNumber     int64     `gorm:"column:adjust_number" db:"column:adjust_number" json:"adjust_number" form:"adjust_number"`
    WarehouseCheckId int64     `gorm:"column:warehouse_check_id" db:"column:warehouse_check_id" json:"warehouse_check_id" form:"warehouse_check_id"`
    ThreeWarehouse   AutoGenerated   `gorm:"column:three_warehouse" db:"column:three_warehouse" json:"three_warehouse" form:"three_warehouse"`
    CreatedAt        time.Time `gorm:"column:created_at" db:"column:created_at" json:"created_at" form:"created_at"`
    UpdatedAt        time.Time `gorm:"column:updated_at" db:"column:updated_at" json:"updated_at" form:"updated_at"`
}

type AutoGenerated []struct {
    WarehouseID  int    `json:"warehouse_id"`
    BookNumber   string `json:"book_number"`
    AdjustNumber string `json:"adjust_number"`
}

func (j *AutoGenerated) Scan(value interface{}) error {
    bytes, _ := value.([]uint8)
    var lins AutoGenerated
    json.Unmarshal([]byte(bytes), &lins)
//打印lins ,输出正常
    j = &lins
// 把值赋给 指针,输出是null
    return nil
}

func (j AutoGenerated) Value() (driver.Value, error) {
    return j, nil
}

其中ThreeWarehouse 这个字段为json 数组格式的字符 格式

[{"warehouse_id":1,"book_number":"0","adjust_number":"15"}]

然后我自定义的类型AutoGenerated,代码如上方,我把json绑定到结构体,打印都正常,但是赋值给指针,后接口请求不正常;哪位大神知道下,我这种怎么处理,谢谢🙏

目前返回的数据格式是

{
        "id": 3,
        "code": "PD1648024354793825",
        "name": "",
        "warehouse_id": 1,
        "state": 1,
        "company_id": 1092,
        "user_id": 1,
        "created_at": "2022-03-23T16:32:34+08:00",
        "updated_at": "2022-03-23T16:54:30+08:00",
        "deleted_at": "2022-03-23T16:54:30+08:00",
        "CheckGoods": [
            {
                "id": 3,
                "goods_id": 1,
                "sku_code": "164802272092095",
                "remarks": "",
                "real_number": 2580,
                "book_number": 3000,
                "adjust_number": -420,
                "warehouse_check_id": 3,
                "three_warehouse": null, 
                "created_at": "2022-03-23T16:32:34+08:00",
                "updated_at": "2022-03-23T16:32:34+08:00"
            }
        ]
    }]
}

可以看出three_warehouse,这个字段返回的是null 我期望的是

{
        "id": 3,
        "code": "PD1648024354793825",
        "name": "",
        "warehouse_id": 1,
        "state": 1,
        "company_id": 1092,
        "user_id": 1,
        "created_at": "2022-03-23T16:32:34+08:00",
        "updated_at": "2022-03-23T16:54:30+08:00",
        "deleted_at": "2022-03-23T16:54:30+08:00",
        "CheckGoods": [
            {
                "id": 3,
                "goods_id": 1,
                "sku_code": "164802272092095",
                "remarks": "",
                "real_number": 2580,
                "book_number": 3000,
                "adjust_number": -420,
                "warehouse_check_id": 3,
github-actions[bot] commented 2 years ago

Bot detected the issue body's language is not English, translate it automatically.

my question is How to parse a json array of mysql string type with grom custom fields

type WarehouseCheckGoods struct {
    ID int64 `gorm:"column:id" db:"column:id" json:"id" form:"id"`
    GoodsId int64 `gorm:"column:goods_id" db:"column:goods_id" json:"goods_id" form:"goods_id"`
    SkuCode string `gorm:"column:sku_code" db:"column:sku_code" json:"sku_code" form:"sku_code"`
    Remarks string `gorm:"column:remarks" db:"column:remarks" json:"remarks" form:"remarks"`
    RealNumber int64 `gorm:"column:real_number" db:"column:real_number" json:"real_number" form:"real_number"`
    BookNumber int64 `gorm:"column:book_number" db:"column:book_number" json:"book_number" form:"book_number"`
    AdjustNumber int64 `gorm:"column:adjust_number" db:"column:adjust_number" json:"adjust_number" form:"adjust_number"`
    WarehouseCheckId int64 `gorm:"column:warehouse_check_id" db:"column:warehouse_check_id" json:"warehouse_check_id" form:"warehouse_check_id"`
    ThreeWarehouse AutoGenerated `gorm:"column:three_warehouse" db:"column:three_warehouse" json:"three_warehouse" form:"three_warehouse"`
    CreatedAt time.Time `gorm:"column:created_at" db:"column:created_at" json:"created_at" form:"created_at"`
    UpdatedAt time.Time `gorm:"column:updated_at" db:"column:updated_at" json:"updated_at" form:"updated_at"`
}

type AutoGenerated []struct {
    WarehouseID int `json:"warehouse_id"`
    BookNumber string `json:"book_number"`
    AdjustNumber string `json:"adjust_number"`
}

func (j *AutoGenerated) Scan(value interface{}) error {
    bytes, _ := value.([]uint8)
    var lins AutoGenerated
    json.Unmarshal([]byte(bytes), &lins)
//Print lins, the output is normal
    j = &lins
// assign value to pointer, output is null
    return nil
}

func (j AutoGenerated) Value() (driver.Value, error) {
    return j, nil
}

Among them, the ThreeWarehouse field is the character format of the json array format

[{"warehouse_id":1,"book_number":"0","adjust_number":"15"}]

Then I customized the type AutoGenerated, the code is as above, I bound json to the structure, the printing is normal, but the assignment to the pointer, the interface request is not normal; who knows, how should I deal with this, thank you🙏

The data format currently returned is

{
        "id": 3,
        "code": "PD1648024354793825",
        "name": "",
        "warehouse_id": 1,
        "state": 1,
        "company_id": 1092,
        "user_id": 1,
        "created_at": "2022-03-23T16:32:34+08:00",
        "updated_at": "2022-03-23T16:54:30+08:00",
        "deleted_at": "2022-03-23T16:54:30+08:00",
        "CheckGoods": [
            {
                "id": 3,
                "goods_id": 1,
                "sku_code": "164802272092095",
                "remarks": "",
                "real_number": 2580,
                "book_number": 3000,
                "adjust_number": -420,
                "warehouse_check_id": 3,
                "three_warehouse": null,
                "created_at": "2022-03-23T16:32:34+08:00",
                "updated_at": "2022-03-23T16:32:34+08:00"
            }
        ]
    }]
}

It can be seen that three_warehouse, this field returns null what i expect is

{
        "id": 3,
        "code": "PD1648024354793825",
        "name": "",
        "warehouse_id": 1,
        "state": 1,
        "company_id": 1092,
        "user_id": 1,
        "created_at": "2022-03-23T16:32:34+08:00",
        "updated_at": "2022-03-23T16:54:30+08:00",
        "deleted_at": "2022-03-23T16:54:30+08:00",
        "CheckGoods": [
            {
                "id": 3,
                "goods_id": 1,
                "sku_code": "164802272092095",
                "remarks": "",
                "real_number": 2580,
                "book_number": 3000,
                "adjust_number": -420,
                "warehouse_check_id": 3,
a631807682 commented 2 years ago

Гэта кавалак рускай мовы

github-actions[bot] commented 2 years ago

Bot detected the issue body's language is not English, translate it automatically.

Geta kavalak ruskai mov

a631807682 commented 2 years ago

Это отрывок из белорусского языка

github-actions[bot] commented 2 years ago

Bot detected the issue body's language is not English, translate it automatically.

This is an excerpt from the Belarusian language

a631807682 commented 2 years ago

Describe the bug 不翻译注释

//连接数据库gorm.io/gorm
db, err := gorm.Open(mysql.New(mysql.Config{
    DriverName: "mysql",
    DSN:        "root:123456@(127.0.0.1:3306)/gomicro_test?charset=utf8mb4&parseTime=True&loc=Local",
}))
github-actions[bot] commented 2 years ago

Bot detected the issue body's language is not English, translate it automatically.

Describe the bug Do not translate comments

//Connect to the database gorm.io/gorm
db, err := gorm.Open(mysql.New(mysql.Config{
DriverName: "mysql",
DSN: "root:123456@(127.0.0.1:3306)/gomicro_test?charset=utf8mb4&parseTime=True&loc=Local",
}))
a631807682 commented 2 years ago

Это отрывок из белорусского языка

github-actions[bot] commented 2 years ago

Bot detected the issue body's language is not English, translate it automatically.

This is an excerpt from the Belarusian language