Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func main() {
- var bulkid int64
- bulkid = 47
- FetchSendTBL(bulkid)
- }
- type SendTBLFields struct {
- Bulk_id int64
- User_id string
- }
- type TBLConfig struct {
- Name string
- RowKeys []string
- RangKeys []string
- NameOfTBLFields interface{}
- }
- var SendTBLConfig = TBLConfig{
- Name: "sendtbl", /* SendTBL */
- RowKeys: []string{"Bulk_id"},
- RangKeys: []string{},
- NameOfTBLFields: SendTBLFields{},
- }
- func FetchSendTBL(ids ...interface{}) {
- SelectRow(SendTBLConfig, ids)
- }
- func SelectRow(TBLConfig TBLConfig, ids ...interface{}) {
- tableName := TBLConfig.Name
- tablePrimaryKeys := TBLConfig.RowKeys
- where := []string{}
- for _, key := range tablePrimaryKeys {
- where = append(where, strings.ToLower(fmt.Sprintf("%q", key))+" = ?")
- }
- session := ConnectionSession.Session()
- err := session.Query(fmt.Sprintf(`SELECT * FROM %q WHERE %s LIMIT 1`, tableName, strings.Join(where, " AND ")), ids...).Scan(&bulk_id);
- if err != nil {
- fmt.Print(err)
- }
- fmt.Println("result ", bulk_id)
- }
- func SelectRows(TBLConfig TBLConfig, ids ...interface{}) {}
Add Comment
Please, Sign In to add comment