@@ -27,15 +27,15 @@ type NodePoolDao interface {
2727var _ NodePoolDao = & sqlNodePoolDao {}
2828
2929type sqlNodePoolDao struct {
30- sessionFactory * db.SessionFactory
30+ sessionFactory db.SessionFactory
3131}
3232
33- func NewNodePoolDao (sessionFactory * db.SessionFactory ) NodePoolDao {
33+ func NewNodePoolDao (sessionFactory db.SessionFactory ) NodePoolDao {
3434 return & sqlNodePoolDao {sessionFactory : sessionFactory }
3535}
3636
3737func (d * sqlNodePoolDao ) Get (ctx context.Context , id string ) (* api.NodePool , error ) {
38- g2 := ( * d .sessionFactory ) .New (ctx )
38+ g2 := d .sessionFactory .New (ctx )
3939 var nodePool api.NodePool
4040 if err := g2 .Take (& nodePool , "id = ?" , id ).Error ; err != nil {
4141 return nil , err
@@ -44,7 +44,7 @@ func (d *sqlNodePoolDao) Get(ctx context.Context, id string) (*api.NodePool, err
4444}
4545
4646func (d * sqlNodePoolDao ) GetByIDAndOwner (ctx context.Context , id string , ownerID string ) (* api.NodePool , error ) {
47- g2 := ( * d .sessionFactory ) .New (ctx )
47+ g2 := d .sessionFactory .New (ctx )
4848 var nodePool api.NodePool
4949 if err := g2 .Take (& nodePool , "id = ? AND owner_id = ?" , id , ownerID ).Error ; err != nil {
5050 return nil , err
@@ -53,7 +53,7 @@ func (d *sqlNodePoolDao) GetByIDAndOwner(ctx context.Context, id string, ownerID
5353}
5454
5555func (d * sqlNodePoolDao ) GetForUpdate (ctx context.Context , id string ) (* api.NodePool , error ) {
56- g2 := ( * d .sessionFactory ) .New (ctx )
56+ g2 := d .sessionFactory .New (ctx )
5757 var nodePool api.NodePool
5858 if err := g2 .Clauses (clause.Locking {Strength : "UPDATE" }).Take (& nodePool , "id = ?" , id ).Error ; err != nil {
5959 return nil , err
@@ -62,7 +62,7 @@ func (d *sqlNodePoolDao) GetForUpdate(ctx context.Context, id string) (*api.Node
6262}
6363
6464func (d * sqlNodePoolDao ) SaveStatusConditions (ctx context.Context , id string , statusConditions []byte ) error {
65- g2 := ( * d .sessionFactory ) .New (ctx )
65+ g2 := d .sessionFactory .New (ctx )
6666 result := g2 .Model (& api.NodePool {}).Where ("id = ?" , id ).Update ("status_conditions" , statusConditions )
6767 if result .Error != nil {
6868 db .MarkForRollback (ctx , result .Error )
@@ -72,7 +72,7 @@ func (d *sqlNodePoolDao) SaveStatusConditions(ctx context.Context, id string, st
7272}
7373
7474func (d * sqlNodePoolDao ) Create (ctx context.Context , nodePool * api.NodePool ) (* api.NodePool , error ) {
75- g2 := ( * d .sessionFactory ) .New (ctx )
75+ g2 := d .sessionFactory .New (ctx )
7676 if err := g2 .Omit (clause .Associations ).Create (nodePool ).Error ; err != nil {
7777 db .MarkForRollback (ctx , err )
7878 return nil , err
@@ -81,7 +81,7 @@ func (d *sqlNodePoolDao) Create(ctx context.Context, nodePool *api.NodePool) (*a
8181}
8282
8383func (d * sqlNodePoolDao ) Save (ctx context.Context , nodePool * api.NodePool ) error {
84- g2 := ( * d .sessionFactory ) .New (ctx )
84+ g2 := d .sessionFactory .New (ctx )
8585 if err := g2 .Omit (clause .Associations ).Save (nodePool ).Error ; err != nil {
8686 db .MarkForRollback (ctx , err )
8787 return err
@@ -90,7 +90,7 @@ func (d *sqlNodePoolDao) Save(ctx context.Context, nodePool *api.NodePool) error
9090}
9191
9292func (d * sqlNodePoolDao ) Delete (ctx context.Context , id string ) error {
93- g2 := ( * d .sessionFactory ) .New (ctx )
93+ g2 := d .sessionFactory .New (ctx )
9494 if err := g2 .Omit (clause .Associations ).Delete (& api.NodePool {Meta : api.Meta {ID : id }}).Error ; err != nil {
9595 db .MarkForRollback (ctx , err )
9696 return err
@@ -99,7 +99,7 @@ func (d *sqlNodePoolDao) Delete(ctx context.Context, id string) error {
9999}
100100
101101func (d * sqlNodePoolDao ) FindByIDs (ctx context.Context , ids []string ) (api.NodePoolList , error ) {
102- g2 := ( * d .sessionFactory ) .New (ctx )
102+ g2 := d .sessionFactory .New (ctx )
103103 nodePools := api.NodePoolList {}
104104 if err := g2 .Where ("id in (?)" , ids ).Find (& nodePools ).Error ; err != nil {
105105 return nil , err
@@ -108,7 +108,7 @@ func (d *sqlNodePoolDao) FindByIDs(ctx context.Context, ids []string) (api.NodeP
108108}
109109
110110func (d * sqlNodePoolDao ) FindByOwner (ctx context.Context , ownerID string ) (api.NodePoolList , error ) {
111- g2 := ( * d .sessionFactory ) .New (ctx )
111+ g2 := d .sessionFactory .New (ctx )
112112 var nodePools api.NodePoolList
113113 if err := g2 .Where ("owner_id = ?" , ownerID ).Find (& nodePools ).Error ; err != nil {
114114 return nil , err
@@ -120,7 +120,7 @@ func (d *sqlNodePoolDao) SaveAll(ctx context.Context, nodePools api.NodePoolList
120120 if len (nodePools ) == 0 {
121121 return nil
122122 }
123- g2 := ( * d .sessionFactory ) .New (ctx )
123+ g2 := d .sessionFactory .New (ctx )
124124 if err := g2 .Omit (clause .Associations ).Save (nodePools ).Error ; err != nil {
125125 db .MarkForRollback (ctx , err )
126126 return err
@@ -129,7 +129,7 @@ func (d *sqlNodePoolDao) SaveAll(ctx context.Context, nodePools api.NodePoolList
129129}
130130
131131func (d * sqlNodePoolDao ) ExistsByOwner (ctx context.Context , ownerID string ) (bool , error ) {
132- g2 := ( * d .sessionFactory ) .New (ctx )
132+ g2 := d .sessionFactory .New (ctx )
133133 var count int64
134134 if err := g2 .Model (& api.NodePool {}).Where ("owner_id = ?" , ownerID ).Limit (1 ).Count (& count ).Error ; err != nil {
135135 return false , err
@@ -138,7 +138,7 @@ func (d *sqlNodePoolDao) ExistsByOwner(ctx context.Context, ownerID string) (boo
138138}
139139
140140func (d * sqlNodePoolDao ) All (ctx context.Context ) (api.NodePoolList , error ) {
141- g2 := ( * d .sessionFactory ) .New (ctx )
141+ g2 := d .sessionFactory .New (ctx )
142142 nodePools := api.NodePoolList {}
143143 if err := g2 .Find (& nodePools ).Error ; err != nil {
144144 return nil , err
0 commit comments