# 图规则原生插件中的函数插件共用数据吗

**URL:** <https://askemq.com/t/topic/8994>\
**Category:** eKuiper\
**Created:** [2024 年7 月 25 日 09:39 UTC](https://askemq.com/t/topic/8994 "2024-07-25T09:39:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

作者： ![veddy](https://askemq.com/letter_avatar/veddy/32/6_449c533f586939b6e5f246632a46421f.png) [@veddy](https://askemq.com/u/veddy)\
发布日期： [2024 年7 月 25 日 09:39 UTC](https://askemq.com/t/topic/8994/1 "2024-07-25T09:39:22Z")

</div>

```auto
type f struct {
	value []float64
}

```

在图规则中拖拽了两个名称为f的函数插件，每个函数插件都会在流进来的时候读取value，并且向value中放入数据。

第一个函数向value中添加了为1的值，第二个函数读取的时候却能读取到1，按理说各个函数插件不应该是独立的吗。

---

<div class="post-metadata">

作者： ![huangjy](https://askemq.com/letter_avatar/huangjy/32/6_449c533f586939b6e5f246632a46421f.png) [@huangjy](https://askemq.com/u/huangjy)\
发布日期： [2024 年7 月 25 日 10:20 UTC](https://askemq.com/t/topic/8994/2 "2024-07-25T10:20:05Z")

</div>

你自己写的插件吗? 插件返回的时候用函数，不要用实例变量，否则所有插件都会是同一个实例。`func AccumulateWordCount() api.Function { return &accumulateWordCountFunc{} }`
