ExWechatpay.Config.Schema (ex_wechatpay v0.3.5)

View Source

配置模式模块

该模块定义了 ExWechatpay 的配置模式,用于验证配置的正确性。 通过使用 NimbleOptions 提供强大的配置验证功能,确保应用程序的配置符合预期。

Summary

Functions

生成配置文档

获取配置模式

验证配置

验证配置(如果验证失败则抛出异常)

Types

t()

@type t() ::
  keyword(
    {:appid, binary()}
    | {:mchid, binary()}
    | {:service_host, binary()}
    | {:notify_url, binary()}
    | {:apiv3_key, binary()}
    | {:wx_pubs, [term()]}
    | {:client_serial_no, binary()}
    | {:client_key, binary() | term()}
    | {:client_cert, binary() | term()}
    | {:timeout, pos_integer()}
    | {:retry, boolean()}
    | {:retry_times, pos_integer()}
    | {:retry_delay, pos_integer()}
    | {:log_level, term()}
  )

Functions

docs()

@spec docs() :: binary()

生成配置文档

返回值

  • docs - 配置文档(Markdown 格式)

schema()

@spec schema() :: keyword()

获取配置模式

返回值

  • config_schema - 配置模式

validate(opts)

@spec validate(keyword()) :: {:ok, keyword()} | {:error, term()}

验证配置

参数

  • opts - 要验证的配置选项

返回值

  • {:ok, validated_config} - 验证通过的配置
  • {:error, error} - 验证失败的错误信息

validate!(opts)

@spec validate!(keyword()) :: keyword()

验证配置(如果验证失败则抛出异常)

参数

  • opts - 要验证的配置选项

返回值

  • validated_config - 验证通过的配置

异常