Git Product home page Git Product logo

Comments (3)

dosubot avatar dosubot commented on May 28, 2024 2

🤖

Hello @tutengdihuang! 👋

I'm Dosu, a friendly bot here to assist you with your issues, answer queries, and guide you on your journey towards becoming an amazing contributor. While we wait for a human maintainer, I'm here to make sure you're not left hanging. Looking forward to working with you! 😄

根据我在Kratos仓库中找到的类似问题,你可能需要将你的wokerStartup函数改为依赖于特定的Job实例:

func wokerStartup(job1 worker.JobA, job2 worker.Job2) {
    jobs := []worker.Job{job1, job2}
    for i := 0; i < len(jobs); i++ {
        jobs[i].Handle()
    }
}

如果wokerStartup函数比较复杂并且需要被重用,你可以使用Option模式:

首先,创建一个新的WorkerOption

type WorkerOption struct{
    Jobs []worker.Job
}

然后让wokerStartup依赖于这个WorkerOptionNewWorkerOption应该依赖于特定的Job实例。

这个解决方案来自于Kratos仓库的这个问题

如果你在实施这个解决方案时遇到任何问题,或者这个解决方案不能解决你的问题,请提供更多的信息,我会尽我所能帮助你。

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

from kratos.

shenqidebaozi avatar shenqidebaozi commented on May 28, 2024

Is the injected type the same as the dependent type

from kratos.

tutengdihuang avatar tutengdihuang commented on May 28, 2024

Is the injected type the same as the dependent type

Thanks for your replay, and I have fixed the issue, because of the type problme. And thanks again!

from kratos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.