Documentation ¶
Index ¶
Constants ¶
View Source
const (
TableName = "session"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IRepository ¶
type IRepository interface { NewEntity(ctx context.Context, userId uint) (*Session, error) // Get returns the session with the specified user ID. GetByUserID(ctx context.Context, userId uint) (*Session, error) // Create saves a new entity in the storage. Create(ctx context.Context, entity *Session) error // Update updates the entity with given ID in the storage. Update(ctx context.Context, entity *Session) error // Delete removes the entity with given ID from the storage. Delete(ctx context.Context, id uint) error SetDefaultConditions(conditions map[string]interface{}) GetVar(session *Session, name string) (interface{}, bool) SetVar(session *Session, name string, val interface{}) error }
IRepository encapsulates the logic to access session from the data source.
type Session ¶
type Session struct { ID uint `gorm:"PRIMARY_KEY" json:"id"` UserID uint `sql:"type:int REFERENCES \"user\"(id)" json:"userId"` User user.User `gorm:"FOREIGNKEY:UserID;association_autoupdate:false" json:"author"` Json string `sql:"type:JSONB NOT NULL DEFAULT '{}'::JSONB"` Data Data `gorm:"-"` Ctx context.Context `gorm:"-"` CreatedAt time.Time `json:"created"` UpdatedAt time.Time `json:"updated"` DeletedAt *time.Time `gorm:"INDEX" json:"deleted"` }
Session is the session entity
func (*Session) SetDataByJson ¶
func (*Session) SetJsonByData ¶
Click to show internal directories.
Click to hide internal directories.