Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 13:43
    maxim-morozenko starred jinzhu/gorm
  • 13:11
    MJobLee starred jinzhu/gorm
  • 10:33
    cuongw starred jinzhu/gorm
  • 10:03
    fantasyRqg starred jinzhu/gorm
  • 09:51
    YahuiAn commented #2406
  • 09:47
    fcodetop commented #2315
  • 09:46
    fcodetop commented #2315
  • 09:46
    fcodetop commented #2315
  • 09:18
    YahuiAn commented #2406
  • 09:01
    srlemon opened #2811
  • 08:45
    fcodetop commented #2315
  • 08:45
    fcodetop commented #2315
  • 08:45
    fcodetop commented #2315
  • 08:43
    fcodetop commented #2315
  • 08:23
    blackbinbinbinbin starred jinzhu/gorm
  • 07:29
    yushine commented #2736
  • 06:55
    bhavyasree96 opened #2810
  • 06:06
    dirkarnez starred jinzhu/gorm
  • 03:55
    uplemon starred jinzhu/gorm
  • 03:51
    uplemon starred jinzhu/gorm
Magnus
@Lallassu
How can I change primary key? I don't want a composite primary key but I rather want a different field than the default "id" to be the primary key?
specifying a different field as primary_key makes it composite key with the "id".
Guess skipping to include gorm.Model works
sober-watchdog
@sober-watchdog
Is there ORMy way of appending elements to an array? Or am I stuck with using raw SQL for this?
matrixbot
@matrixbot
Paul I've had no problem with gorm converting time.Time to timestamp with time zone
cheche
@chezixin
The time type of my module is int, sorry, let everyone laugh.
matrixbot
@matrixbot
Paul which is which?
Paul and which direction is the data going?
Slava Shklyar
@slavash
@amarjeetanandsingh .Find(&perzUsers) return *gorm.DB... you need .Find(&perzUsers).Error
Nikhil Sharma
@ennsharma
I have an object (Person) with a has many association with another object (Toy). How do I update a Toy to have it belong to a new Person?
tenfy
@tenfyzhong
Hi. Is there any option to set context to a query?
Charles Green
@charlesgreen
Hello, I'm working with Postgresql with a text[] column. Are text arrays supported?
I'm receiving the following error which I thought was caused by null values but confirmed the column does not have any nulls.
sql: Scan error on column index 7, name "odpt_destinationstation": unsupported Scan, storing driver.Value type []uint8 into type *[]string
Charles Green
@charlesgreen
Looks like the same cases as here.
jinzhu/gorm#1248
All good. thanks.
cheche
@chezixin
Ask for advice:
db.Unscoped().Where("deleted_on != ? ", 0).Delete(&Tag{})
deleted_on is of type int
If deleted_on is a timestamp and the value is null, how should it be expressed?
philipp1992
@philipp1992
Hi guys, i have the following query: db.Where("user_id = ?", tmpUser.ID).Find(&subscriptions), subscriptions is a slice of subscription struct
the problem is, that it will output also the relations
how can i query only the subscriptions where user_id = x without getting back the related objects to the subscription?
Ghost
@ghost~5de77fd5d73408ce4fd304f0

Can someone help me? How to change this query:

select count(t.) from (SELECT FROM table WHERE table = 'abc' LIMIT 12 OFFSET 12) AS t

to GORM

matrixbot
@matrixbot
Paul you can send plain queries to gorm if you wish
Paul but for the subqyery: http://gorm.io/docs/query.html#SubQuery
Ghost
@ghost~5de7831fd73408ce4fd30566
I dont want to use sqlbuilder because my parameters are dynamic (WHERE), im using subquery but is not working, Count dosent work w offset
Ghost
@ghost~5de7853ed73408ce4fd305a7
db.Where("count(t.*)", db.Table("table t").Where("table = ?", abc).QueryExpr()).Row().Scan(&count), return 0
matrixbot
@matrixbot
Paul log the sql and look at what gorm actually sends
connorladly
@connorladlyfredeen
Question, I am looking to do preloading. I make a call to preload and I see no error (which I had previously seen with the wrong preload value) but then I see no query occuring for the pre-loaded values. Who can I get them to actually performt the preload?
Stefanos Chrs
@stefanoschrs
Hello is there a way to use types to write a join and not plain strings?
For example the following is as unsafe is as writing a raw sql, if the model changes the user.name to user.fullName then it is broken. Additionally you need to remember table names, column names where you have everything in the struct.
db.
  Table("users").
  Select("users.name, emails.email").
  Joins("left join emails on emails.user_id = users.id").
  Rows()
sina nadihagh
@nadihagh
hi
is anybody there?
helloooo
I have a problem
please someone answer me
vegan2019
@vegan2019
Hello , newbie to Golang
Massimiliano Bertinetti
@Acciaiodigitale
@nadihagh very bad mood
Princewill Samuel
@9r1nc3w1ll_gitlab
Hello has anyone done migrations that modify table structure (add, update or delete column(s)) using Gorm. I can't find anything in the docs on that
Gabriel Pickl
@peacememories
hey all, i got a small question. i have a model that contains time.Duration as a type, and currently I save that to the database by storing start and end time (in one case), or calculating the number of minutes/seconds the Duration represents (in other cases). Is there a way to encode this marshalling in gorm (like, define a function that is used instead of the object field)?
Gabriel Pickl
@peacememories
okay, some more searching got me to this: jinzhu/gorm#677
which scanner is jinzhu referring to here?
Short Stop
@shortstopnews

I have a really odd issue that I can't seem to work out. When I execute a preload for a certain struct, it runs the following SQL:

SELECT * FROM "articles" INNER JOIN "sub_article_hottest_caches" ON "sub_article_hottest_caches"."article_id" = "articles"."article_id" WHERE ("sub_article_hottest_caches"."article_cache_id" IN (954,90
8,909,905,898,899,900,901,902,903)) ORDER BY "sub_article_hottest_caches".rank ASC

Which returns 0 rows, however, running the same query in the DB returns many rows. What is going on here?

Short Stop
@shortstopnews

@jinzhu For whatever reason, the SQL builder seems to be building the string wrong:

With db.Exec:

[2019-12-11 00:45:29]  [1.00ms]
        SELECT * FROM "articles" INNER JOIN "sub_article_hottest_caches" ON "sub_article_hottest_caches"."article_id" = "articles"."article_id" WHERE ("sub_article_hottest_caches"."article_cache_id" IN (923,926,918,920,922,924,927,929,954,916))
[13 rows affected or returned ]

Using Preload:

[2019-12-11 00:45:29]  [2.00ms]  SELECT * FROM "articles" INNER JOIN "sub_article_hottest_caches" ON "sub_article_hottest_caches"."article_id" = "articles"."article_id" WHERE ("sub_article_hottest_caches"."article_cache_id" IN (954,91
6,923,924,929,927,918,920,922,926))
[0 rows affected or returned ]
The list is put onto a new line when it should not be
ONG-YA
@ONG-YA
go-gorm connection pool is not working,it creates lots of time_wait connections
help ~
Muhammad Alfan Miftakhul Hudha
@malfanmh
guys can we use an args ~ map[string]interface{} with type slice in value i.e ["id"]= []int64{1,2}
i got this error
sql: converting argument $1 type: unsupported type []int64, a slice of int64
ONG-YA
@ONG-YA
@jinzhu
assalyk
@assalyk
Hi is anyone online ?
i need help for my project ^^'
Eduardo Mior
@eduardo-mior
how to put SSL_KEY and SSL_CERT in gorm? I'm hours trying to connect to a bank that uses SSL
hurryhx
@hurryhx
I have some questions about HAS MANY relationship. Is there any gorm project example about that? Thanks!