Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. type TableOne struct {
  2. Id int
  3. name string
  4. date string
  5. }
  6.  
  7. type TableTwo struct {
  8. Id int
  9. address string
  10. athome bool
  11. }
  12.  
  13. func SaveMyTables(tablename string, obj *struct{ Id int }) {
  14. // ... Some code here
  15.  
  16. if obj.Id != 0 {
  17. // ... Some code here
  18. }
  19.  
  20. // ... Some code here
  21. }
  22.  
  23. obj := &TableTwo{
  24. Id: 5
  25. address: "some address"
  26. athome: false
  27. }
  28.  
  29. myPackage.Save("addresses", obj).
  30.  
  31. cannot use obj (type *mytables.TableTwo) as type *struct { Id int } in argument to myPackage.Save
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement