Documentation
¶
Index ¶
- func Init()
- type DataClient
- type Setting
- type SettingService
- type SettingServiceImpl
- func (s *SettingServiceImpl) Delete(name string, settingType SettingType) error
- func (s *SettingServiceImpl) Get(name string, settingType SettingType) (string, error)
- func (s *SettingServiceImpl) List() ([]Setting, error)
- func (s *SettingServiceImpl) ListType(settingType SettingType) ([]Setting, error)
- func (s *SettingServiceImpl) Set(name string, settingType SettingType, val string) error
- type SettingType
- type Text
- type TextService
- type TextServiceImpl
- func (t TextServiceImpl) Count() int64
- func (t TextServiceImpl) CreateText(text Text) (*Text, error)
- func (t TextServiceImpl) DeleteText(id uint) error
- func (t TextServiceImpl) Exists(text Text) bool
- func (t TextServiceImpl) Get(text Text) (*Text, error)
- func (t TextServiceImpl) GetTextByNamespace(namespace string) ([]Text, error)
- func (t TextServiceImpl) GetTextBySpeaker(speaker string) ([]Text, error)
- func (t TextServiceImpl) List(text Text) ([]Text, error)
- func (t TextServiceImpl) ListAll() ([]Text, error)
- func (t TextServiceImpl) RandomRecord(rule Text) (*Text, error)
- func (t TextServiceImpl) UpdateText(text Text) (*Text, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DataClient ¶ added in v1.1.0
type DataClient struct { Setting SettingService Text TextService // contains filtered or unexported fields }
var Client *DataClient
func NewDataClient ¶ added in v1.1.0
func NewDataClient(db *gorm.DB, settingService SettingService, textService TextService) *DataClient
type Setting ¶ added in v1.1.0
type Setting struct { gorm.Model Name string `gorm:"not null;uniqueIndex"` Type SettingType `gorm:"not null;index"` Val string `gorm:"not null"` }
type SettingService ¶ added in v1.1.0
type SettingService interface { Get(name string, settingType SettingType) (string, error) Set(name string, settingType SettingType, val string) error Delete(name string, settingType SettingType) error List() ([]Setting, error) ListType(settingType SettingType) ([]Setting, error) }
func NewSettingService ¶ added in v1.1.0
func NewSettingService(db *gorm.DB) SettingService
type SettingServiceImpl ¶ added in v1.1.0
type SettingServiceImpl struct {
// contains filtered or unexported fields
}
func (*SettingServiceImpl) Delete ¶ added in v1.1.0
func (s *SettingServiceImpl) Delete(name string, settingType SettingType) error
func (*SettingServiceImpl) Get ¶ added in v1.1.0
func (s *SettingServiceImpl) Get(name string, settingType SettingType) (string, error)
func (*SettingServiceImpl) List ¶ added in v1.1.0
func (s *SettingServiceImpl) List() ([]Setting, error)
func (*SettingServiceImpl) ListType ¶ added in v1.1.0
func (s *SettingServiceImpl) ListType(settingType SettingType) ([]Setting, error)
func (*SettingServiceImpl) Set ¶ added in v1.1.0
func (s *SettingServiceImpl) Set(name string, settingType SettingType, val string) error
type SettingType ¶ added in v1.1.0
type SettingType string
const (
SettingTypeSystem SettingType = "system"
)
type TextService ¶ added in v1.1.0
type TextService interface { Get(text Text) (*Text, error) List(text Text) ([]Text, error) GetTextByNamespace(namespace string) ([]Text, error) GetTextBySpeaker(speaker string) ([]Text, error) ListAll() ([]Text, error) CreateText(text Text) (*Text, error) UpdateText(text Text) (*Text, error) DeleteText(id uint) error Count() int64 RandomRecord(rule Text) (*Text, error) Exists(text Text) bool }
func NewTextService ¶ added in v1.1.0
func NewTextService(db *gorm.DB) TextService
type TextServiceImpl ¶ added in v1.1.0
type TextServiceImpl struct {
// contains filtered or unexported fields
}
func (TextServiceImpl) Count ¶ added in v1.1.0
func (t TextServiceImpl) Count() int64
func (TextServiceImpl) CreateText ¶ added in v1.1.0
func (t TextServiceImpl) CreateText(text Text) (*Text, error)
func (TextServiceImpl) DeleteText ¶ added in v1.1.0
func (t TextServiceImpl) DeleteText(id uint) error
func (TextServiceImpl) Exists ¶ added in v1.1.0
func (t TextServiceImpl) Exists(text Text) bool
func (TextServiceImpl) GetTextByNamespace ¶ added in v1.1.0
func (t TextServiceImpl) GetTextByNamespace(namespace string) ([]Text, error)
func (TextServiceImpl) GetTextBySpeaker ¶ added in v1.1.0
func (t TextServiceImpl) GetTextBySpeaker(speaker string) ([]Text, error)
func (TextServiceImpl) List ¶ added in v1.1.0
func (t TextServiceImpl) List(text Text) ([]Text, error)
func (TextServiceImpl) ListAll ¶ added in v1.1.0
func (t TextServiceImpl) ListAll() ([]Text, error)
func (TextServiceImpl) RandomRecord ¶ added in v1.1.0
func (t TextServiceImpl) RandomRecord(rule Text) (*Text, error)
func (TextServiceImpl) UpdateText ¶ added in v1.1.0
func (t TextServiceImpl) UpdateText(text Text) (*Text, error)
Click to show internal directories.
Click to hide internal directories.