Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service represents service used to
func (*Service) Exec ¶
func (s *Service) Exec(ctx context.Context, any interface{}, options ...loption.Option) (int, error)
Exec executes load statement specific for database
Example ¶
package main import ( "context" "database/sql" "fmt" "github.com/viant/sqlx/io/load" "log" _ "github.com/viant/sqlx/metadata/product/mysql/load" ) func main() { type Foo struct { ID int Name string } dsn := "" db, err := sql.Open("mysql", dsn) if err != nil { log.Fatalln(err) } loader, err := load.New(context.Background(), db, "dest_table") if err != nil { log.Fatalln(err) } var data []Foo //data = getAppData() count, err := loader.Exec(context.TODO(), &data) if err != nil { log.Fatalln(err) } fmt.Printf("loaded %v\n", count) }
Output:
Click to show internal directories.
Click to hide internal directories.