31 lines
528 B
Go
31 lines
528 B
Go
package session
|
|
|
|
import (
|
|
"SciencesServer/utils"
|
|
"encoding/json"
|
|
"fmt"
|
|
)
|
|
|
|
// Tenant 租户数据信息
|
|
type Tenant struct {
|
|
ID uint64 `json:"id"`
|
|
Name string `json:"name"`
|
|
Domain string `json:"domain"`
|
|
}
|
|
|
|
func (this *Tenant) IDToString() string {
|
|
return fmt.Sprintf("%d", this.ID)
|
|
}
|
|
|
|
func (this *Tenant) MarshalBinary() ([]byte, error) {
|
|
return json.Marshal(this)
|
|
}
|
|
|
|
func (this *Tenant) UnmarshalBinary(data []byte) error {
|
|
return utils.FromJSONBytes(data, this)
|
|
}
|
|
|
|
func NewTenant() *Tenant {
|
|
return &Tenant{}
|
|
}
|