blog

package
v0.0.0-...-9c393dc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

README

文章管理

  • 定义接口: 保护数据结构, 叫做领域接口
  • 接口的具体实现:
  • 每个模块管理着自己的数据, 如果别的业务模块想要查询 这个领域的数据, 必须通过领域接口, 不能绕过接口接口访问数据

分层2层:

  • 业务的定义, 只是声明
  • 业务的实现
    • 实现接口 (impl)
    • 接口约束 var _ blog.Service = &impl{}
    • 实现后能不能正常工作: 需要我们写单元测试, 采用TDD(Test Drive Develop)来方式来编写业务代码
    • 业务功能测试OK, 可以进入接口的开发阶段

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blog

type Blog struct {
	Title   string `json:"title"`
	Content string `json:"content"`
}

type Service

type Service interface {
	CreateBlog(context.Context, *Blog) error
}

博客管理业务接口

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL