package relation import ( "github.com/gshopify/service-wrapper/model" "gshopper.com/gshopify/products/graphql/generated" "time" ) type ProductOption struct { Id string `db:"id"` Name string `db:"name"` SelectedValue string `db:"value"` Values []string `db:"values"` Position int8 `db:"position"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` PublishedAt *time.Time `db:"published_at"` DeletedAt *time.Time `db:"deleted_at"` } func (opt *ProductOption) As() *generated.ProductOption { return &generated.ProductOption{ ID: model.NewId(model.GidOption, opt.Id), Name: opt.Name, Values: opt.Values, } } func (opt *ProductOption) AsSelected() *generated.SelectedOption { return &generated.SelectedOption{ Name: opt.Name, Value: opt.SelectedValue, } }