github.com/reggieriser/pop@v4.13.1+incompatible/genny/model/_fixtures/models/widget_empty.go (about)

     1  package models
     2  
     3  import (
     4  	"encoding/json"
     5  
     6  	"github.com/gobuffalo/pop"
     7  	"github.com/gobuffalo/validate"
     8  )
     9  
    10  // Widget is used by pop to map your widgets database table to your go code.
    11  type Widget struct {
    12  }
    13  
    14  // String is not required by pop and may be deleted
    15  func (w Widget) String() string {
    16  	jw, _ := json.Marshal(w)
    17  	return string(jw)
    18  }
    19  
    20  // Widgets is not required by pop and may be deleted
    21  type Widgets []Widget
    22  
    23  // String is not required by pop and may be deleted
    24  func (w Widgets) String() string {
    25  	jw, _ := json.Marshal(w)
    26  	return string(jw)
    27  }
    28  
    29  // Validate gets run every time you call a "pop.Validate*" (pop.ValidateAndSave, pop.ValidateAndCreate, pop.ValidateAndUpdate) method.
    30  // This method is not required and may be deleted.
    31  func (w *Widget) Validate(tx *pop.Connection) (*validate.Errors, error) {
    32  	return validate.NewErrors(), nil
    33  }
    34  
    35  // ValidateCreate gets run every time you call "pop.ValidateAndCreate" method.
    36  // This method is not required and may be deleted.
    37  func (w *Widget) ValidateCreate(tx *pop.Connection) (*validate.Errors, error) {
    38  	return validate.NewErrors(), nil
    39  }
    40  
    41  // ValidateUpdate gets run every time you call "pop.ValidateAndUpdate" method.
    42  // This method is not required and may be deleted.
    43  func (w *Widget) ValidateUpdate(tx *pop.Connection) (*validate.Errors, error) {
    44  	return validate.NewErrors(), nil
    45  }