driver

package
v0.0.0-...-c60d2c3 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BitableSchema         = "bitable"
	DefaultPageSize int64 = 50
)
View Source
const (
	RecordKeyPerson      = "persons"
	RecordKeyUrl         = "url"
	RecordKeyOptions     = "options"
	RecordKeyAttachments = "attachments"
)
View Source
const (
	FieldKeyRecordID = "record_id"
)

Variables

View Source
var (
	ErrNullValue = errors.New("null value")
)

Functions

func WithUserToken

func WithUserToken(ctx context.Context, userToken string) context.Context

WithUserToken add `user_access_token` to context.Value

Types

type AppMeta

type AppMeta lark.AppMeta

AppMeta a App meta.

type Attachment

type Attachment lark.FieldAttachment

Attachment a field value for attachment.

type Conn

type Conn struct {
	*lark.BiTable

	AppID     string
	AppSecret string
	AppToken  string
	// contains filtered or unexported fields
}

Conn for db open

func (*Conn) Begin

func (c *Conn) Begin() (driver.Tx, error)

Begin tx begin

func (*Conn) Close

func (c *Conn) Close() error

Close db connection close

func (*Conn) Ping

func (c *Conn) Ping(ctx context.Context) error

Ping check client connection

func (*Conn) Prepare

func (c *Conn) Prepare(query string) (driver.Stmt, error)

Prepare statement for prepare exec

func (*Conn) PrepareContext

func (c *Conn) PrepareContext(ctx context.Context, query string) (driver.Stmt, error)

PrepareContext statement for prepare exec

func (*Conn) Query

func (c *Conn) Query(query string, args []driver.Value) (driver.Rows, error)

func (*Conn) QueryContext

func (c *Conn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (driver.Rows, error)

QueryContext the context timeout and return when the context is canceled.

type Driver

type Driver struct {
}

Driver bitable driver for implement database/sql/driver

func (*Driver) Open

func (driver *Driver) Open(name string) (driver.Conn, error)

Open for implement driver interface

type Field

type Field struct {
	FieldID   string         `json:"field_id,omitempty"`
	FieldName string         `json:"field_name,omitempty"`
	Type      int64          `json:"type,omitempty"`
	Property  *FieldProperty `json:"property,omitempty"`
}

Field a field info

type FieldOption

type FieldOption struct {
	Name string `json:"name,omitempty"`
	Id   string `json:"id,omitempty"`
}

FieldOption when field.Type can be select.

type FieldProperty

type FieldProperty struct {
	Options    []*FieldOption `json:"options,omitempty"`
	Formatter  string         `json:"formatter,omitempty"`
	DateFormat string         `json:"date_format,omitempty"`
	TimeFormat string         `json:"time_format,omitempty"`
	AutoFill   bool           `json:"auto_fill,omitempty"`
	Multiple   bool           `json:"multiple,omitempty"`
	TableId    string         `json:"table_id,omitempty"`
	ViewId     string         `json:"view_id,omitempty"`
	Fields     []string       `json:"fields,omitempty"`
}

FieldProperty a field property. Different types have different values.

type FieldType

type FieldType int64
const (
	FieldTypeText              FieldType = 1    //  多行文本
	FieldTypeNumber            FieldType = 2    //  数字
	FieldTypeSelect            FieldType = 3    //  单选
	FieldTypeMultipleSelect    FieldType = 4    //  多选
	FieldTypeDate              FieldType = 5    //  日期
	FieldTypeCheckbox          FieldType = 7    //  复选框
	FieldTypePerson            FieldType = 11   //  人员
	FieldTypeLink              FieldType = 15   //  超链接
	FieldTypeAttachment        FieldType = 17   //  附件
	FieldTypeOneWayAssociation FieldType = 18   //  单向关联
	FieldTypeReferenceLookup   FieldType = 19   //  引用查找
	FieldTypeFormula           FieldType = 20   //  公式
	FieldTypeTwoWayAssociation FieldType = 21   //  双向关联
	FieldTypeCreateTime        FieldType = 1001 //  创建时间
	FieldTypeUpdateTime        FieldType = 1002 //  最后更新时间
	FieldTypeFounder           FieldType = 1003 //  创建人
	FieldTypeModifier          FieldType = 1004 //  修改人
)

type Person

type Person lark.FieldPerson

Person a field value for person.

type Record

type Record lark.Record

Record a record meta.

type RecordAttachments

type RecordAttachments []Attachment

type RecordKey

type RecordKey string

type RecordOptions

type RecordOptions []string

type RecordPersons

type RecordPersons []Person

type RecordUrl

type RecordUrl URL

type Rows

type Rows interface {
	Columns() []string
	Close() error
	Next(in Rows, dest []driver.Value) error
	Load() (pageList *lark.PageList, err error)
	Pick(dst []driver.Value, item interface{})
}

type Table

type Table lark.Table

Table a table meta.

type URL

type URL lark.FieldURL

URL a field value for link.

type View

type View lark.View

View a view meta.

type ViewType

type ViewType string
const (
	ViewTypeGrid    ViewType = "grid"    //  表格视图
	ViewTypeKanban  ViewType = "kanban"  //  看板视图
	ViewTypeGantt   ViewType = "gantt"   //  甘特视图
	ViewTypeGallery ViewType = "gallery" //  画册视图
	ViewTypeForm    ViewType = "form"    //  表单视图
)

Jump to

Keyboard shortcuts

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