Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BulkInsert ¶
func BulkInsert(db *gorm.DB, objects interface{}, chunkSize int, replace bool, excludeColumns ...string) error
Insert multiple records at once [objects] Must be a slice of struct [chunkSize] Number of records to insert at once.
Embedding a large number of variables at once will raise an error beyond the limit of prepared statement. Larger size will normally lead the better performance, but 2000 to 3000 is reasonable.
[excludeColumns] Columns you want to exclude from insert. You can omit if there is no column you want to exclude.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func NewBuilder ¶
func NewBuilder(opts ...BuilderOpt) *Builder
type BuilderOpt ¶
type BuilderOpt func(*Builder)
func ChunkSizeOpt ¶
func ChunkSizeOpt(chunkSize int) BuilderOpt
func ExcludeColumnsOpt ¶
func ExcludeColumnsOpt(excludeColumns []string) BuilderOpt
func ReplaceOpt ¶
func ReplaceOpt(replace bool) BuilderOpt
Click to show internal directories.
Click to hide internal directories.