Documentation ¶
Index ¶
- func WithAllowFromGroup(onlyFromGroup bool) func(*Options)
- func WithAllowFromPrivate(onlyFromPrivate bool) func(*Options)
- func WithAutoRejectCall() func(*Options)
- func WithCmdCacheTimeout(respCacheTimeout time.Duration) func(*Options)
- func WithCommandLog(cmdLog bool) func(*Options)
- func WithDebugMessage() func(*Options)
- func WithHistorySync() func(*Options)
- func WithHostNumber(hostNumber string) func(*Options)
- func WithLogLevel(logLevel string) func(*Options)
- func WithOSInfo(osInfo string) func(*Options)
- func WithOnlyFromSelf(onlyFromSelf bool) func(*Options)
- func WithPairCodeLogin() func(*Options)
- func WithPostgresDSN(pgDsn *PostgresDSN) func(*Options)
- func WithScanQRLogin() func(*Options)
- func WithSendMsgTimeout(sendMsgTimeout time.Duration) func(*Options)
- func WithSqlDB(sqlDB *sql.DB) func(*Options)
- func WithSqliteFile(sqliteFile string) func(*Options)
- func WithStoreMode(storeMode string) func(*Options)
- type LoginOptions
- type Options
- type PostgresDSN
- func (dsn *PostgresDSN) FromEnv() *PostgresDSN
- func (dsn *PostgresDSN) GenerateDSN() string
- func (dsn *PostgresDSN) SetDatabase(database string) *PostgresDSN
- func (dsn *PostgresDSN) SetHost(host string) *PostgresDSN
- func (dsn *PostgresDSN) SetMode(sslMode string) *PostgresDSN
- func (dsn *PostgresDSN) SetPassword(password string) *PostgresDSN
- func (dsn *PostgresDSN) SetPort(port string) *PostgresDSN
- func (dsn *PostgresDSN) SetUsername(userName string) *PostgresDSN
- func (dsn *PostgresDSN) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithAllowFromGroup ¶
func WithAllowFromPrivate ¶
func WithAutoRejectCall ¶ added in v1.2.0
func WithAutoRejectCall() func(*Options)
func WithCmdCacheTimeout ¶
func WithCommandLog ¶
func WithDebugMessage ¶ added in v1.2.0
func WithDebugMessage() func(*Options)
func WithHistorySync ¶ added in v1.2.0
func WithHistorySync() func(*Options)
func WithHostNumber ¶
func WithLogLevel ¶
func WithOSInfo ¶ added in v1.2.0
func WithOnlyFromSelf ¶
func WithPairCodeLogin ¶
func WithPairCodeLogin() func(*Options)
func WithPostgresDSN ¶
func WithPostgresDSN(pgDsn *PostgresDSN) func(*Options)
func WithScanQRLogin ¶
func WithScanQRLogin() func(*Options)
func WithSendMsgTimeout ¶
func WithSqliteFile ¶
func WithStoreMode ¶
Types ¶
type LoginOptions ¶
type LoginOptions int8
const ( SCAN_QR LoginOptions = 0 PAIR_CODE LoginOptions = 1 )
type Options ¶
type Options struct { // HostNumber will use the first available device when null HostNumber string // StoreMode can be "postgres" or "sqlite" StoreMode string // LogLevel: "INFO", "ERROR", "WARN", "DEBUG" LogLevel string // This PostgresDsn Must add when StoreMode equal to "postgres" PostgresDsn *PostgresDSN // This SqliteFile Generate "ROXY.DB" when it null SqliteFile string // WithSqlDB wrap with sql.DB interface WithSqlDB *sql.DB WithCommandLog bool CommandResponseCacheTimeout time.Duration SendMessageTimeout time.Duration // OSInfo system name in client OSInfo string // LoginOptions constant of ScanQR or PairCode LoginOptions LoginOptions // HistorySync is used to synchronize message history HistorySync bool // AutoRejectCall allow to auto reject incoming calls AutoRejectCall bool // AllowFromPrivate allow messages from private AllowFromPrivate bool // AllowFromGroup allow message from groups AllowFromGroup bool // OnlyFromSelf allow only from self messages OnlyFromSelf bool // CommandSuggestion allow command suggestion CommandSuggestion bool // DebugMessage debug incoming message to console DebugMessage bool }
func NewDefaultOptions ¶
func NewDefaultOptions() *Options
type PostgresDSN ¶
type PostgresDSN struct { Host string Username string Password string Database string Port string SslMode string }
func NewPostgresDSN ¶
func NewPostgresDSN() *PostgresDSN
func (*PostgresDSN) FromEnv ¶
func (dsn *PostgresDSN) FromEnv() *PostgresDSN
func (*PostgresDSN) GenerateDSN ¶
func (dsn *PostgresDSN) GenerateDSN() string
func (*PostgresDSN) SetDatabase ¶
func (dsn *PostgresDSN) SetDatabase(database string) *PostgresDSN
func (*PostgresDSN) SetHost ¶
func (dsn *PostgresDSN) SetHost(host string) *PostgresDSN
func (*PostgresDSN) SetMode ¶
func (dsn *PostgresDSN) SetMode(sslMode string) *PostgresDSN
func (*PostgresDSN) SetPassword ¶
func (dsn *PostgresDSN) SetPassword(password string) *PostgresDSN
func (*PostgresDSN) SetPort ¶
func (dsn *PostgresDSN) SetPort(port string) *PostgresDSN
func (*PostgresDSN) SetUsername ¶
func (dsn *PostgresDSN) SetUsername(userName string) *PostgresDSN
func (*PostgresDSN) Validate ¶
func (dsn *PostgresDSN) Validate() error
Click to show internal directories.
Click to hide internal directories.